Opened 13 years ago
Closed 13 years ago
#6068 closed bug (fixed)
Elements removed from a jQuery object with .filter() are still inserted with .prependTo() and .appendTo()
Reported by: | elijahr | Owned by: | |
---|---|---|---|
Priority: | Milestone: | 1.4.2 | |
Component: | manipulation | Version: | 1.4.1 |
Keywords: | filter, prependTo, appendTo | Cc: | |
Blocked by: | Blocking: |
Description
If I filter a jQuery object and use .prependTo() or .appendTo() to insert the elements into the document, the removed elements are still inserted into the document. See below for an example:
<script> var
html = '<style type="text/css">body {color:red;}</style>' +
'<script>alert("foo")</script>' + '<div id="foo">bar</div>',
$elems = $(html).filter('div'); $elems contains only the <div> element
$elems.prependTo(document.body); the <style>, <script>, and <div> elements are all inserted into the document's body.
only the <div> should be inserted. </script>
Note: See
TracTickets for help on using
tickets.
Fixed. http://github.com/jquery/jquery/commit/726fda08bea7bbd72d73be4563aba855c63966fe