Opened 15 years ago
Closed 15 years ago
#2787 closed bug (fixed)
Attribute filter ignores elements not appended to DOM tree
Reported by: | arrix | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | core | Version: | 1.2.3 |
Keywords: | selector | Cc: | |
Blocked by: | Blocking: |
Description
Attribute filter ([attribute=value]) cannot select elements not appended to the document tree.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>1.2.4a Rev: 5390</title> <script type="text/javascript" src="../jquery/dist/jquery.js"></script> <script type="text/javascript"> $(function() { var f = $('<form><input type="button" name="ok" value="OK"/></form>'); alert(f.find('input[name="ok"]').length); //0 but should be 1 f.appendTo(document.body); alert(f.find('input[name="ok"]').length); //1 }); </script> </head> <body> </body> </html>
1.2.4a Rev: 5390
Change History (3)
comment:1 Changed 15 years ago by
comment:3 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed, check #1960 for more details.
Note: See
TracTickets for help on using
tickets.
It's in selector.js jQuery.filter (near line 338)
of course document.getElementsByName only returns elements in the document tree.