通过将 Sizzle.js 与 jquery1.4.2 一起包含,我可以获得什么好处?

发布于 2024-08-31 01:41:23 字数 629 浏览 3 评论 0原文

从 jquery.com 下载的最新 jquery 1.4.2 还附带 Sizzle.js。

我可以如何从包含的 Sizzle.js 中获得什么好处?

Sizzle.js 是一个独立的库吗?

为什么它包含在 jquery 库中,目的是什么?

/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */

虽然 sizzle.js 网站上提到了这一点

完全独立(没有库 依赖项)

latest jquery 1.4.2 downloaded from jquery.com comes with Sizzle.js also.

How and what benefit can I take from included Sizzle.js?

Is Sizzle.js a standalone library?

Why it's included inside jquery library, for what purpose?

/*!
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */

while this is mentioned on sizzle.js website

Completely standalone (no library
dependencies)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

琉璃繁缕 2024-09-07 01:41:23

Sizzle.js 是一个 JavaScript 库,它实现了“旨在轻松放入主机库的 CSS 选择器引擎”。 jQuery 在内部使用它来满足 CSS 选择需求。如果您想要一个 CSS 引擎并且不需要 jQuery 的所有其他 JavaScript 优势,您可以单独使用 Sizzle.js。

Sizzle.js is a JavaScript library that implements a "CSS selector engine designed to be easily dropped in to a host library." jQuery uses it internally for its CSS selection needs. If you wanted a CSS engine and had no need for all the other JavaScript benefits of jQuery, you could use Sizzle.js separately.

生来就爱笑 2024-09-07 01:41:23

好吧,实际上我并不清楚 sizzle.js 是什么。基本上,它的作用是允许您在“选择器”(即类、ID、DOM 元素等)上使用 javascript。
因此,当您在 jQuery 中使用它时:

$('div')

sizzle.js 正在发挥作用,使该元素可用于 javascript。

我希望我没问题:)

OK, it was actually pretty unclear what sizzle.js was to me. Basically, what it does is allows you to use javascript on 'selectors', that is, classes, IDs, DOM elements, etc...
So when you use this in jQuery:

$('div')

That's sizzle.js at work, making that element available to javascript.

I hope I got that all right :)

悲凉≈ 2024-09-07 01:41:23

jQuery 需要嘶嘶声才能发挥作用。您可以利用有效的 javascript 库。

jQuery requires sizzle in order to function. You can take the benefit of a working javascript library.

深海夜未眠 2024-09-07 01:41:23

这是相关资源:

http://wiki.github.com/jeresig/sizzle/

选择器功能

* CSS 3 Selector support
* Full Unicode support
* Escaped selector support #id\:value
* Contains text :contains(text)
* Complex :not :not(a#id)
* Multiple :not :not(div,p)
* Not attribute value [name!=value]
* Has selector :has(div)
* Position selectors :first, :last, :even, :odd, :gt, :lt, :eq
* Easy Form selectors :input, :text, :checkbox, :file, :password, :submit, etc
* Header selector :header

代码功能

* Provides meaningful error messages for syntax problems
* Uses a single code path (no XPath)
* Uses no browser-sniffing
* Caja-compatible code

Here is the resource for that:

http://wiki.github.com/jeresig/sizzle/

Selector Features

* CSS 3 Selector support
* Full Unicode support
* Escaped selector support #id\:value
* Contains text :contains(text)
* Complex :not :not(a#id)
* Multiple :not :not(div,p)
* Not attribute value [name!=value]
* Has selector :has(div)
* Position selectors :first, :last, :even, :odd, :gt, :lt, :eq
* Easy Form selectors :input, :text, :checkbox, :file, :password, :submit, etc
* Header selector :header

Code Features

* Provides meaningful error messages for syntax problems
* Uses a single code path (no XPath)
* Uses no browser-sniffing
* Caja-compatible code
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文