Bug Tracker

Ticket #11300 (closed enhancement: fixed)

Opened 3 years ago

Last modified 23 months ago

Docs Bug: The :contains() selector statement about quotes is confusing...

Reported by: anonymous Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocking: Blocked by:

Description

The  docs for the :contains() selector states...

"As with attribute value selectors, text inside the parentheses of :contains() can be written as bare words or surrounded by quotation marks."

...but  docs for attribute selectors state...

"Quotes are mandatory."

Change History

comment:1 Changed 3 years ago by dmethvin

  • Keywords needsdocs added
  • Priority changed from undecided to low
  • Component changed from unfiled to attributes
  • Type changed from bug to enhancement

Yeah, neither is quite accurate. Quotes are only mandatory for attribute values if they are not identifiers, so [type=text] is fine. I am not sure of the specifics of :contains() but it seems we should encourage the same rule regardless of how it's currently implemented.

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to fixed

Docs updated.

comment:3 Changed 3 years ago by anonymous

Replying to dmethvin:

Docs updated.

I see you updated the docs for the attribute-equals-selector, but the other various attribute selectors still state...

"Quotes are mandatory."

Is this intentional? If so, could you please explain the reason for the different requirements.

If it helps, the following is a list of attribute selectors that have not been updated...

  • h ttp://api.jquery.com/attribute-contains-prefix-selector/
  • h ttp://api.jquery.com/attribute-contains-selector/
  • h ttp://api.jquery.com/attribute-contains-word-selector/
  • h ttp://api.jquery.com/attribute-ends-with-selector/
  • h ttp://api.jquery.com/attribute-not-equal-selector/
  • h ttp://api.jquery.com/attribute-starts-with-selector/

(Sorry for the broken links, but it's getting spam-blocked.)

FWIW, I tested each one using querySelectorAll in Chrome 17, and the only one that throws is the not equal selector, but that seems to be because it's a non-standard selector. Quotes made no difference either way.

 http://jsfiddle.net/MR39H/

comment:4 follow-up: ↓ 5 Changed 3 years ago by dmethvin

Yep, should have fixed those too. I'll get to it this afternoon.

Trac is more friendly if you create an account, otherwise it's pretty aggressive about potential spam. We get a *lot* of spam.

comment:5 in reply to: ↑ 4 Changed 3 years ago by anonymous

Replying to dmethvin:

Yep, should have fixed those too. I'll get to it this afternoon.

My apologies for not catching this before, but there's one more page that would need updating.

It's the Category page for Selectors > Attribute

 http://api.jquery.com/category/selectors/attribute-selectors/

The current wording is...

"Attribute values in selector expressions must be surrounded by quotation marks."

comment:6 Changed 23 months ago by mikesherov

  • Keywords needsdocs removed
Note: See TracTickets for help on using tickets.