Bug Tracker

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: [email protected] Owned by:
Priority: low Milestone: 1.8
Component: manipulation Version: 1.7.1
Keywords: Cc: dmethvin
Blocked by: Blocking:


Although this is probably an IE only bug, jQuery "falls" for it and a workaround can be easily provided. Steps to reproduce:

  1. Insert an new element using 'append' with an 'onclick' event.
  2. In IE, set Local Intranet security zone's Active Scripting to Enabled, and Internet security zone's Active Scripting to disabled.
  3. 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).
  4. 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 Rick Waldron

Cc: dmethvin added
Component: unfiledmanipulation
Priority: undecidedlow

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)

comment:2 Changed 11 years ago by dmethvin

Blocked by: 10515 added
Milestone: None1.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 dmethvin

Status: newopen

comment:4 Changed 11 years ago by dmethvin

Blocked by: 10515 removed

comment:4 Changed 11 years ago by dmethvin

Resolution: patchwelcome
Status: openclosed

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.

Note: See TracTickets for help on using tickets.