Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10283 closed bug (duplicate)

append() fails with a JS error on IE 6-8 with jQuery created HTML5 elements

Reported by: Haprog Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.4rc1
Keywords: Cc:
Blocked by: Blocking:


jQuery .append() fails with a JavaScript error on Internet Explorer 6, 7 and 8 when you create a new <nav> element (or any other new HTML5 element) with some content, and then try to append content to it.

var test = $('<nav>Test</nav>');
test.append('append'); /* Fails with an error in IE 6-8 */

Here is a simple test case showing the problem: http://www.haprogszone.net/jquery_bug_ie6-8.html (includes the html5shiv but it doesn't seem to affect the problem)

This works in Firefox 6.0.2, Chrome 13, Safari 5.1 and Internet Explorer 9, but fails on IE 6, 7 and 8. Tested on Windows 7 (32bit). The problem occurs on every major version of jQuery I tested including 1.6.4.

Interestingly though (as shown in the above test case URL) the same error does not occur when the created <nav> is first empty

var test = $('<nav></nav>');
test.append('append'); /* Works */

The problem does not occur when dealing with HTML4 elements instead.

Change History (5)

comment:1 Changed 12 years ago by Haprog

Found out a workaround.

Instead of

var test = $('<nav>Test</nav>');

you can do

var test = $('<nav/>');

and you will have no problem.

comment:2 Changed 12 years ago by dmethvin

Resolution: invalid
Status: newclosed

You need an HTML5 shiv / shim, ask for help on the forum if you need more help.

comment:3 Changed 12 years ago by Rick Waldron

Resolution: invalid
Status: closedreopened

comment:4 Changed 12 years ago by Rick Waldron

Resolution: duplicate
Status: reopenedclosed

comment:5 Changed 12 years ago by Rick Waldron

Duplicate of #6485.

Note: See TracTickets for help on using tickets.