Side navigation
#4068 closed bug (duplicate)
Opened February 04, 2009 07:17PM UTC
Closed October 07, 2010 10:00PM UTC
Last modified March 15, 2012 02:07PM UTC
Attribute filtering does not work for style attribute
Reported by: | bgrinstead | Owned by: | john |
---|---|---|---|
Priority: | major | Milestone: | 1.3.2 |
Component: | selector | Version: | 1.3.1 |
Keywords: | selector attribute filter | Cc: | |
Blocked by: | Blocking: |
Description
I noticed that jQuery was not selecting elements when attempting to filter based on the style attribute. It works fine for others, like 'name', just not 'style'.
Here is an example:
<span style="font-weight:bold;">This is bold</span> <span style="font-style:italic;">This is italic</span> <span style="text-decoration:underline;">This is underlined</span> <span name="thisworks">This IS selected by the attribute filter</span> <script type="text/javascript"> $(function() { alert($("span[style*='bold']").length); alert($("span[style^='font-style']").length); alert($("span[style$='underline']").length); alert($("span[name*='works']").length); }); </script>
Thanks!
Attachments (0)
Change History (4)
Changed February 08, 2009 07:05PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed February 08, 2009 07:25PM UTC by comment:2
Changed February 08, 2009 07:44PM UTC by comment:3
resolution: | invalid |
---|---|
status: | closed → reopened |
I'm going to reopen this because it looks like it might be a regression due to the integration of Sizzle.
The
attribute does not return a string. You would need to match the css property, so the attribute selector syntax isn't the droid you're looking for. I think there is a plugin floating around that adds to the selector syntax but I couldn't find it. This plugin would seem to do the job as well, but with a different syntax:http://plugins.jquery.com/project/EnhancedAttributeSelectors