Bug Tracker

Opened 8 years ago

Last modified 8 years ago

#10427 closed bug

Creating custom elements is broken on IE7 and 8 using $('<...>'). — at Initial Version

Reported by: bmustiata Owned by:
Priority: undecided Milestone:
Component: manipulation Version: 1.7b1
Keywords: 1.8-discuss Cc:
Blocked by: Blocking:

Description

Fiddle test case: http://jsfiddle.net/nmfCy/1/

Proposed Patch: http://download.androidknight.com/jquery-custom-elements-1.6.4.patch

Full-Original: http://download.androidknight.com/jquery-1.6.4-original.js

Full-Patched : http://download.androidknight.com/jquery-1.6.4-patched.js

Description. The expected nodes to be added is: <customelement>

However in IE7/8 (IE9 works fine) two elements get created after innerHtml is set: <customelement>

and

</customelement> (!!) - yes, with the beginning slash character as tagName,

and all the content that should belong in the <customelement> is now a sibling living between the two elements.

This needs to work, since the HTML5 elements do match the criteria of unknown elements, and creating them programatically now breaks the DOM structure in IE7/8 (same example but with a canvas element instead: http://jsfiddle.net/nmfCy/2/).

To make matters worse the added elements (via innerHtml) are unknown html elements, that do not allow creating child elements into them.

However, if we create the same element with document.createElement('customelement') and we append this one to the DOM, we can add children elements into it.

The given patch adds the check for custom elements support, and if it does not exists, it then attempts to find and fix the eventually broken newly created custom elements (in the clean method).

The patch was tested against IE7, IE8, IE9, Chrome 14.0 and Firefox 7.0.1.

Change History (0)

Note: See TracTickets for help on using tickets.