This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm working on an application which includes a text editor, and jQuery has been really useful for me so far. However, I just noticed something which might be a problem for my app. I provide a button for users to display the page's html, and it looks like jQuery appends its own attribute to referenced elements. I'm testing on IE7 and Firefox 3, and this only happens in IE. Given the following simple html, the alert displays this text-
in IE: <INPUT id=button1 type=button value="Click here to see HTML" jQuery1249910571515="2">
in FF: <INPUT id=button1 type=button value="Click here to see HTML" >
Bear Bibeault wrote:So? What's the problem this is causing?
Amy does not want the person copying the code to have unnecessary attributes in the markup.
If you are letting them edit it there as an HTML view, you need to keep those attributes there or your code is not going to work so well.
Joined: Apr 19, 2009
Thanks for your replies. There is no functional problem caused by the jQueryDDDD attribute being there; the only problem is probable user confusion on seeing those extra jQuery attributes upon viewing the HTML source. Also, yes, I should have mentioned that users can edit the html source view; my application is really just a plugin for FCKEditor (open source text editor).
I'll test the suggestion to strip the jQueryDDDD attribute to see if it causes any problems when switching back and forth between HTML/Design views. Thanks again-
Joined: Nov 08, 2001
If you remove those references, I have a feeling JQuery will stop working.
Joined: Apr 19, 2009
Just got a chance to test this today. I used your suggestion to do a replace with regex to strip all jquerydddd attributes, and it worked like a charm. Also doesn't seem to cause any subsequent referencing issues. I do the replace each time user toggles to view html source.
Since it was mentioned that this attribute may be used for memory leak protection/cleanup, I'll do some further testing to see if IE memory usage seems affected by the change. If so, I'll post the findings.