Bug Tracker

Modify

Ticket #10903 (closed bug: patchwelcome)

Opened 19 months ago

Last modified 13 months ago

'append' in IE local intranet web site does not work well with if Internet security zone Active Scripting is disabled

Reported by: ewolfman@… Owned by:
Priority: low Milestone: 1.8
Component: manipulation Version: 1.7.1
Keywords: Cc: dmethvin
Blocking: Blocked by:

Description

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

comment:1 Changed 19 months ago by rwaldron

  • Cc dmethvin added
  • Priority changed from undecided to low
  • Component changed from unfiled to manipulation

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 19 months ago by dmethvin

  • Blocked by 10515 added
  • Milestone changed from None to 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 19 months ago by dmethvin

  • Status changed from new to open

comment:4 Changed 13 months ago by dmethvin

  • Blocked by 10515 removed

comment:4 Changed 13 months ago by dmethvin

  • Status changed from open to closed
  • Resolution set to patchwelcome

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.