Skip to main content

Bug Tracker

Side navigation

#3399 closed bug (duplicate)

Opened September 23, 2008 02:04PM UTC

Closed October 15, 2010 10:25PM UTC

Last modified March 13, 2012 02:57PM UTC

attribute selector does not match style attribute

Reported by: aaroncrane Owned by: anonymous
Priority: low Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: Cc: jquery@aaroncrane.co.uk, flesler
Blocked by: Blocking:
Description

Attribute selectors of the form 'div[style]' and 'div[title]' do not work as I expect.

I expect 'div[style]' to match every <div> element that bears a style= attribute (regardless of whether that attribute's value is the empty string), and not to match any <div> elements that do not bear any style= attribute.

However, that selector matches every <div>, regardless of whether it has a style= attribute.

I have similar expectations for 'div[title]', except with the title= attribute rather than style=. That selector correctly excludes <div> elements with no title= attribute, but it incorrectly matches <div title=""> elements (with an empty string as the attribute value).

Reductions for both situations are attached. I expect each reduction to display three green-background boxes saying "OK"; a failure is indicated as a red-background box saying "FAIL".

I have tested this in Firefox 2, Firefox 3, Safari 3.0, and Opera 9.5; it behaves the same way in all of them.

Attachments (3)
  • style-attribute-selector.htm (1.2 KB) - added by matejr September 29, 2008 01:17PM UTC.

    Style attribute selector not working

  • style.html (1.0 KB) - added by aaroncrane September 23, 2008 02:05PM UTC.

    Reduction for 'div[style]' selectors

  • title.html (1.0 KB) - added by aaroncrane September 23, 2008 02:05PM UTC.

    Reduction for 'div[title]' selectors

Change History (6)

Changed September 23, 2008 10:57PM UTC by flesler comment:1

cc: jquery@aaroncrane.co.ukjquery@aaroncrane.co.uk, flesler
component: unfilledselector
milestone: → 1.3
status: newassigned

Changed September 29, 2008 01:22PM UTC by matejr comment:2

Style attribute selector doesn't work at all. If I use attribute selector [attribute*=value] the exception is throwed: z.indexOf is not a function

I attached one more file, which demonstrates this.

Changed October 07, 2010 10:02PM UTC by snover comment:3

#4068, #6044, #7078, #7126 are duplicates of this bug.

Changed October 07, 2010 10:03PM UTC by snover comment:4

milestone: 1.31.4.3
owner: flesleranonymous
priority: majorlow
status: assignednew
summary: Inconsistent results with attribute selectors in jQuery 1.2.6attribute selector does not match style attribute
version: 1.2.61.4.2

Changed October 15, 2010 10:25PM UTC by snover comment:5

resolution: → duplicate
status: newclosed

Changed October 15, 2010 10:25PM UTC by snover comment:6

Duplicate of #7128.