#6044 closed bug (duplicate)
$("selector[style='value']", context) does not work
Reported by: | jide | Owned by: | john |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.2 |
Component: | selector | Version: | 1.4.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
See the following code :
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.1EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html>
<head>
<title>Test jQuery</title> <style type="text/css"> </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript">
$(document).ready(function() {
var container = $('#container'); Works : console.log($("div[style='font-size:2em']").html()); Does not work : console.log($("div[style='font-size:2em']", container).html());
});
</script>
</head> <body>
<div id="container">
<div style="font-size:2em">
A test div.
</div>
</div>
</body>
</html>
Change History (8)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Hmmm, this is a better example :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>Test jQuery</title> <style type="text/css"> </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var container = $('#container'); // Works : console.log($("div[style*='background']").html()); // Does not work : console.log($("div[style*='background']", container).html()); }); </script> </head> <body> <div id="container"> <div style="background:red" class="mydiv"> A test div. </div> </div> </body> </html>
comment:3 Changed 13 years ago by
Component: | ajax → selector |
---|---|
Owner: | set to john |
Status: | new → assigned |
Summary: | $("selector[attr='value']", context) does not work → $("selector[style='value']", context) does not work |
comment:4 Changed 13 years ago by
I found a way to fix this :
Edit Sizzle.selectors.filter.ATTR (line 3273 in jquery v1.4.2), and change line 3277 :
elem[ name ] != null && name != 'style' ?
This will treat the style attribute as a regular attribute.
comment:6 Changed 12 years ago by
Priority: | → undecided |
---|---|
Resolution: | → duplicate |
Status: | assigned → closed |
Duplicate of #3399.
comment:7 Changed 12 years ago by
comment:8 Changed 12 years ago by
<a href="http://www.charmforbracelets.com">charm for bracelets</a>delicate and high-profile in its own way. All of these ornaments manifest a postmodernism pattern and brought us strong visual shock impact.Also you can change your cloth a<a href="http://www.charmforbracelets.com">charms for links of London</a>clothe pattern. <a href="http://www.charmforbracelets.com">charm for bracelets</a>
Arghh, there is no way to edit the ticket and I forgot code formatting !
Here we go :