Skip to main content

Bug Tracker

Side navigation

#11958 closed enhancement (invalid)

Opened June 22, 2012 07:00PM UTC

Closed July 08, 2012 08:51AM UTC

JQuery functions fail to start when activated by a dynamically created DOM object, on IE9

Reported by: Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:


I've had a problem regarding dynamically created objects on IE9, and would like to share solution that could be implemented into JQuery core.

It seems that, when new elements are created, IE9 fails to 'see' them (which is the easiest way to say that IE9 don't and won't add these elements to an on-running DOM), and therefore functions activated by such objects can't be started.

It seems to me the most commonly spread workaround is to simply set the browser to function under IE8 standards, by adding the following line to the <head> section of their html code:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

It works fine, but if we think a little from the user's perspective, we start wondering what's the point of using IE9 if you won't use it after all.

So, a much more elegant solution would be to simply attach the newly created DOM object to the list of objects already open. That can be done by simply calling the .data() method, after creating the new object, like in the following example:

$content = '<a href="#" id="test">Test</a>';
$.data('cache', $content);

This way, the object 'test' can be seen by JQuery.

However, that could be avoided by inserting the line

$.data('cache', $content);

(or something equivalent) right into the .html() method, maybe as the last thing to be done.

I've been trying to located where could that ever be done, but it seems the method .html() is declared in such secrecy, that I haven't been able to find it. =)

So, I've decided come here and post this as a suggestion. It is simple, elegant, makes it possible for IE9 standards to be used and would make developers, specially those getting started with JQuery, happier. =)

Thanks for your attention.



Attachments (0)
Change History (2)

Changed June 23, 2012 01:05PM UTC by dmethvin comment:1

owner: →
status: newpending

Can you provide a jsFiddle that demonstrates the problem you're describing?

Changed July 08, 2012 08:51AM UTC by trac-o-bot comment:2

resolution: → invalid
status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!