jquery / jquery/learn.jquery.com

On the distinction between jQuery core methods ( .each() ) in the $.fn name space and jQuery utility methods ( $.each() ) not in the $.fn name space

Open
#799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Chapter: jquery-core help wanted
Dominant language
JavaScript
Stars
915
Forks
471
PR merge metrics
No merged PRs in 30d

Description

The Using jQuery Core chapter begins with the section titled $ vs $().

It's my thought that some additional wording could make the section's lessons more easily realized.

That section draws the distinction between jQuery core (object) methods called on jQuery selections and jQuery utility methods not called on selections. Thrown in on top of that is the further distinction between the $.fn namespace and the $ namespace.

Core (object) methods are identified simply by their names ( .each() ) but are in the $.fn namespace.

Utility methods ( $.each() ) are explicitly identified as members of the jQuery namespace, $, and are not in the $.fn namespace.

Get it?

.each() in $.fn namespace.
$.each() not in $.fn namespace.

My point is that that distinction is not so clearly made in the article. It took me several readings and a day's rumination before the fog lifted. I think that the jQuery novice, who is after all the section's target, would be better served by a more explicit and specific drawing of the distinction than is currently the case.

The point might also be explicitly made that core methods (.remove()) are also called object methods because they have an object, i.e., the jQuery selection ( $( "h1" ) ) upon which they are called ( $( "h1" ).remove() ). I think that would make the terminology seem more sensible and less arbitrary.

May I also suggest that this would be the place to give some insight into the namespace concept, just a paragraph or two. If not, then at least a citation to an article explaining the concept.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Using jQuery Core chapter and its “$ vs $()” section at the linked Learn jQuery URLs. Revise the explanation to distinguish .each() from $.each(), clarify $.fn and object-method terminology, and add namespace context or a citation; done means the distinction is explicit for beginners.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.