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

'Selector' type ambiguous #1040

Open
leonard-thieu opened this issue Jun 7, 2017 · 6 comments
Open

'Selector' type ambiguous #1040

leonard-thieu opened this issue Jun 7, 2017 · 6 comments

Comments

@leonard-thieu
Copy link

From the Types page:

If Selector is specified as the type of an argument, it accepts everything that the jQuery constructor accepts, eg. Strings, Elements, Lists of Elements.

The jQuery constructor accepts Selector, Element, Array, PlainObject, and jQuery.

The definitions are conflicting. Does Selector really mean String when it's used throughout documentation or is the selector argument supposed to be of type String instead of Selector?

@dmethvin
Copy link
Member

A Selector string is a specific type of string that is a valid CSS selector. Note that the jQuery constructor also accepts other strings that represent HTML markup, which we distinguish by how they "look".

What it's saying is that you can pass either a selector string or an element itself, for example jQuery("body"), jQuery(document.body), and jQuery([ document.body ]) all get you the same collection. However, jQuery("<body>") is not the same thing, it's creating a <body> element, not selecting the <body> element in the current document.

@leonard-thieu
Copy link
Author

Thank you for the response. I actually wanted to emphasize the part from the Types page.

If Selector is specified as the type of an argument, it accepts everything that the jQuery constructor accepts, eg. Strings, Elements, Lists of Elements.

After looking over a decent portion of the documentation, it seems that Selector will never refer to Elements or Lists of Elements. I believe that that part of the Types page is incorrect.

@dmethvin
Copy link
Member

Can you suggest some wording that would clarify it?

@leonard-thieu
Copy link
Author

Removing that specific paragraph would be good. The rest of the text describes Selector well and is consistent with how Selector is used throughout the rest of the documentation.

@dmethvin
Copy link
Member

Yep, I agree.

@dmethvin
Copy link
Member

Hey @leonard-thieu did you mean to close this? We should leave the ticket open until the change is made.

@dmethvin dmethvin reopened this Jun 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants