Bug Tracker

Opened 8 years ago

Closed 8 years ago

#11599 closed bug (invalid)

before()/insertBefore() breaks node ordering when using a comment node

Reported by: lucas@… Owned by: lucas@…
Priority: low Milestone: None
Component: manipulation Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:


When inserting more than one node before a comment node the comment node does not stay at the end of the inserted elements in the DOM, it ends up directly after the first inserted node.

$(aCommentNode).before($elsToInsert);//order breaks
$elsToInsert.insertBefore(aCommentNode);//order breaks
//retains correct order
var $comment = $(aCommentNode);
$elsToInsert.each(function() {

Perhaps this affects other non-element nodeTypes as well.

Experienced in Firefox 11 on Win 7.

Change History (5)

comment:1 Changed 8 years ago by addyosmani

Component: unfiledmanipulation
Owner: set to lucas@…
Priority: undecidedlow
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

comment:2 Changed 8 years ago by dmethvin

Also note that in general, text and comment nodes are not supported in a jQuery collection. There are a few methods like .contents() that obtain them but many jQuery methods will either ignore or remove them.

comment:3 Changed 8 years ago by ucavus

Issue no longer present http://jsfiddle.net/aBW3n/1/

comment:4 Changed 8 years ago by ucavus

Make that never present. It's a bug in Firebug. Sorry.

comment:5 Changed 8 years ago by Rick Waldron

Resolution: invalid
Status: pendingclosed

Closing per op

Note: See TracTickets for help on using tickets.