Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[type="text"] selecting input elements with no type attribute #33

Closed
jamietre opened this issue Aug 13, 2012 · 0 comments
Closed

[type="text"] selecting input elements with no type attribute #33

jamietre opened this issue Aug 13, 2012 · 0 comments
Labels

Comments

@jamietre
Copy link
Owner

The default value for "type" is "text" under HTML5, however, CSS selectors act against the HTML markup and not the value of the attribute. This was overzealously implemented in the last release and resulted in all input elements of type text (regardless of whether the attribute was present) being selected. Despite this being an intuitive and useful behavior, it's wrong and is not how browsers do it. Selecting on [type="text"] now correctly ignores input elements with no type attribute.

Note that in jQuery 1.8 the :text selector has been deprecated, leaving no way in the publically supported API to select all text input elements. That is, <input /> is a valid text input according to the HTML5 spec since "text" is the default for the type attribute. The jQuery :text pseudoclass selector does include this (as well as ones that included a type=text attribute), but is now officially deprecated.

I think this is a very useful selector, especially since CsQuery will often be used against HTML which someone else marked up and you don't have the luxury of making sure all your text inputs have a type attribute, so I have no intention of removing it from CsQuery.

Generally speaking since CsQuery does not have all the same goals as jQuery (e.g., small size) I doubt I'll make a habit of ever removing deprecated features, unless there is a conflict with a more current usage.

jamietre added a commit that referenced this issue Aug 13, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant