Opened 11 years ago
Closed 11 years ago
#11599 closed bug (invalid)
before()/insertBefore() breaks node ordering when using a comment node
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | manipulation | Version: | 1.6.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
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() { $comment.before(this); });
Perhaps this affects other non-element nodeTypes as well.
Experienced in Firefox 11 on Win 7.
Change History (5)
comment:1 Changed 11 years ago by
Component: | unfiled → manipulation |
---|---|
Owner: | set to [email protected]… |
Priority: | undecided → low |
Status: | new → pending |
comment:2 Changed 11 years ago by
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.
Note: See
TracTickets for help on using
tickets.
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.