Opened 11 years ago
Closed 11 years ago
#10903 closed bug (patchwelcome)
'append' in IE local intranet web site does not work well with if Internet security zone Active Scripting is disabled
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | manipulation | Version: | 1.7.1 |
Keywords: | Cc: | dmethvin | |
Blocked by: | Blocking: |
Description
Although this is probably an IE only bug, jQuery "falls" for it and a workaround can be easily provided. Steps to reproduce:
- Insert an new element using 'append' with an 'onclick' event.
- In IE, set Local Intranet security zone's Active Scripting to Enabled, and Internet security zone's Active Scripting to disabled.
- Ensure that the html is running on a local web site, by right clicking and selecting Properties on the browsed page. It should read as "Local Intranet" (otherwise the bug will not reproduce).
- Browse the page. The 'onclick' is not triggered.
This seems like an IE bug. It seems like setting the innerHTML property on a new element not yet in the DOM causes IE to ignore the event. If innerHTML is performed on an element that exists in the DOM, the event is triggered correctly. For example: jQuery's 'html' works well because it replaces the innerHTML for an element already in the DOM.
The requested bug fix/workaround is that 'append' (and possibly other jQuery DOM insertion methods) will change the order of things: set the innerHTML after appending the element to the DOM, and not prior to it.
Change History (5)
comment:1 Changed 11 years ago by
Cc: | dmethvin added |
---|---|
Component: | unfiled → manipulation |
Priority: | undecided → low |
comment:2 Changed 11 years ago by
Blocked by: | 10515 added |
---|---|
Milestone: | None → 1.8 |
None of the HTML processing code in jQuery.clean or jQuery.buildFragment currently attaches content to the document, that's done later when the method-specific callback (e.g., append, prepend, before, after) is called. So this isn't a simple change and a very cornery case.
However, we've been talking about using insertAdjacentHTML in #10515 which might solve this problem so I'll leave it open. If it can't be worked in there I think we will close this wontfix.
comment:3 Changed 11 years ago by
Status: | new → open |
---|
comment:4 Changed 11 years ago by
Blocked by: | 10515 removed |
---|
comment:4 Changed 11 years ago by
Resolution: | → patchwelcome |
---|---|
Status: | open → closed |
This doesn't have a simple and performant resolution. If you need to do this, request the content as text and inject it into your own <div>
in the document so that IE will think it belongs there, then use jQuery methods to move it elsewhere. Doing this will cause reflows so try to avoid it at all costs.
It's unreasonable to dictate the order of execution as you've requested, especially when significant performance gains can be achieved by setting HTML in detached nodes, prior to insertion.
This seems like an edge case, I'd like Dave Methvin to weigh in on this (his IE experience is second to none)