Skip to main content

Bug Tracker

Side navigation

#11667 closed bug (duplicate)

Opened April 28, 2012 12:12AM UTC

Closed April 28, 2012 02:51PM UTC

Last modified April 28, 2012 02:51PM UTC

[checked] selector failure

Reported by: bgmort@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocked by: Blocking:
Description

Using a selector that contains [checked] as well as another [attr] selector fails, while using :checked or applying .filter('[checked]') separately to the same selector works as expected. See a detailed example here:

http://jsfiddle.net/bgmort/V3KqD/

Attachments (0)
Change History (3)

Changed April 28, 2012 02:23AM UTC by dmethvin comment:1

Interesting. Some relevant spec:

There is a failure, but I think you have it backwards.

While the :checked pseudo-class is dynamic in nature, and can altered by user action, since it can also be based on the presence of semantic attributes in the document, it applies to all media. For example, the :checked pseudo-class initially applies to such elements that have the HTML4 selected and checked attributes as described in Section 17.2.1 of HTML4, but of course the user can toggle "off" such elements in which case the :checked pseudo-class would no longer apply. -- http://www.w3.org/TR/selectors/#checked

So, "[checked]" should only apply to elements that had a checked attribute initially set in their HTML. The .filter("[checked]") would be wrong then, I suspect it is going through Sizzle and looking at the property rather than the attribute. If so there's already a ticket for that and I'll look at it later.

Changed April 28, 2012 02:51PM UTC by dmethvin comment:2

resolution: → duplicate
status: newclosed

Found the duplicate ticket, which also points out we can't fix this until we remove the boolHook that fixes old broken uses of .attr(). BTW, thank you for the extensive test case!

Changed April 28, 2012 02:51PM UTC by dmethvin comment:3

Duplicate of #11115.