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

未关闭
#799 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
45/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, jquery
领域
documentation

调研方向

从链接的 Learn jQuery URL 中的 Using jQuery Core 章节及其“$ vs $()”部分开始。修改说明,区分 .each() 和 $.each(),阐明 $.fn 和对象方法的术语,并补充 namespace 上下文或引用;当面向初学者明确说明这一差异时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Chapter: jquery-core help wanted

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.

主要语言
JavaScript
星标
914
派生
472
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jquery/learn.jquery.com 的其他 Issue

查看 jquery/learn.jquery.com 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。