jquery / jquery/api.jquery.com
Update the documentation of jQuery.data to indicate what the function actually accepts for the 1st parameter.
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 325
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
The documentation for jQuery.data gives the following signatures:
jQuery.data( element, key, value )
jQuery.data( element, key )
jQuery.data( element )
In all three the element parameter is typed as Element. However, jQuery does accept an element which is of type Document. Two pieces of evidence:
-
In practice, I've used
jQuery.dataonDocumentobjects for years, without any trouble. -
The data machinery calls on
acceptDatato detect whether a node is fit to be used as the first argument of thedatafunction.acceptData's code and comments both explicitly consider thatDocumentis a valid node.
It seems that JavaScript objects that do not have a numeric nodeType field can also be used with jQuery.data. I'm mentioning this for completeness. I've never used this capability.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the jQuery.data documentation page and compare its parameter signatures with src/data/var/acceptData.js, which the issue identifies as evidence for supported nodes. Update the documentation so the first parameter accurately reflects the accepted Document type and clarify the mentioned object behavior if confirmed. Done means the published signatures match the supported inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jquery
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100