aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jQuery question-  jQuery attribute in IE? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jQuery question-  jQuery attribute in IE?" Watch "jQuery question-  jQuery attribute in IE?" New topic
Author

jQuery question- jQuery attribute in IE?

Amy Crowley
Greenhorn

Joined: Apr 19, 2009
Posts: 6
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" >

Any ideas?

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
They do that for memory leak protection. You can strip it out.



Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61180
    
  66

So? What's the problem this is causing?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
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.

Amy,
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.

Eric
Amy Crowley
Greenhorn

Joined: Apr 19, 2009
Posts: 6
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-
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you remove those references, I have a feeling JQuery will stop working.

Eric
Amy Crowley
Greenhorn

Joined: Apr 19, 2009
Posts: 6
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.

Thanks much for your help.
Trilochan Bharadwaj
Ranch Hand

Joined: Feb 02, 2009
Posts: 100
Eric, care to elaborate on how the memory leak protection that you talked about (those identifiers) works? any links?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jQuery question- jQuery attribute in IE?