-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.json
47 lines (47 loc) · 5.69 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
"name": "qwery",
"description": "blazing fast CSS3 query selector engine",
"version": "3.3.11",
"homepage": "https://github.com/ded/qwery",
"author": {
"name": "Dustin Diaz",
"email": "dustin@dustindiaz.com",
"url": "http://dustindiaz.com"
},
"contributors": [
{
"name": "Jacob Thornton",
"url": "https://github.com/fat"
},
{
"name": "Rod Vagg",
"url": "https://github.com/rvagg"
},
{
"name": "Andrew McCollum",
"url": "https://github.com/amccollum"
}
],
"main": "./qwery.js",
"keywords": [
"ender",
"query",
"css",
"selector engine"
],
"ender": "./src/ender.js",
"repository": {
"type": "git",
"url": "https://github.com/ded/qwery.git"
},
"devDependencies": {
"sink-test": ">= 1.0.1",
"serve": "*"
},
"scripts": {
"test": "phantomjs tests/phantom.js"
},
"readme": "Qwery - The Tiny Selector Engine\n-----\nQwery is a small *blazing fast* query selector engine allowing you to select elements with CSS1|2|3 queries\n\n##Acceptable selectors\n\n``` css\n/* basic */\n#foo {} /* id */\n.bar {} /* class */\na#foo.bar {} /* element attribute combinations */\n\n/* attributes */\n#foo a[href] {} /* simple */\n#foo a[href=bar] {} /* attribute values */\n#foo a[lang|=en] {} /* subcodes */\n#foo a[title~=hello] {} /* attribute contains */\n#foo a[href^=\"http://\"] {} /* attribute starts with */\n#foo a[href$=com] {} /* attribute ends with */\n#foo a[href*=twitter] /* {} attribute wildcards */\n\n/* descendants */\n#foo a {} /* all descendants */\nul#list > li {} /* direct children */\n\n/* siblings */\nspan ~ strong {} /* all adjacent */\np + p {} /* immediate adjacent */\n\n/* combos */\ndiv,p {}\n\n/* variations */\n#foo.bar.baz {}\ndiv#baz.thunk a[-data-info*=\"hello world\"] span + strong {}\n#thunk[title$='huzza'] {}\n```\n\nContexts\n-------\nEach query can optionally pass in a context\n\n``` js\nqwery('div', node); // existing DOM node or...\nqwery('div', '#foo'); // another query\n```\n\npseudo selector API\n-------------------\n\nOptionally, Qwery provides a [pseudo selector interface](https://github.com/ded/qwery/blob/master/src/pseudos.js) allowing you to extend into advanced CSS3 matchers. It looks like this:\n\n``` js\nqwery.pseudos['first-child'] = function (el, val) {\n var p;\n return el.parentNode && (p = el.parentNode) && (childs = p.getElementsByTagName('*')) && childs[0] == el;\n};\n```\n\nTo create a new pseudo matcher you must set a property on `qwery.psuedos` with a boolean method that is passed back a candidate element, and a value (if any). For example:\n\n``` js\nqwery('#content p.surprise:foo(bar)')\n\nqwery.pseudos.foo = function (el, val) {\n // val == 'bar'\n return el.getAttribute(val)\n}\n```\n\nConfiguring Qwery\n-----------------\n\nThe `configure()` method takes an options object allowing you to adjust the way that Qwery works internally. Currently only the `useNativeQSA` option is available to turn on and off the use of native `querySelectorAll()` where available.\n\n``` js\nqwery.configure({\n useNativeQSA: false\n})\n```\n\nBrowser Support\n---------------\nQwery attempts to stay up to date with Yahoo's [Grade A Browser Support](http://developer.yahoo.com/yui/articles/gbs) in addition to future browser candidates.\n\n - IE6+\n - Chrome 1+\n - Safari 3+\n - Firefox 2+\n - Opera\n\nDev Env & Testing\n-----\n\n $ npm install smoosh sink-test\n $ make\n $ open tests/index.html\n\nNote\n----\nQwery uses <code>querySelectorAll</code> when available. All <code>querySelectorAll</code> default behavior then applies.\n\nEnder support\n-------------\nQwery is the recommended selector engine for [Ender](http://ender.no.de). If you don't have Ender, install it, and don't ever look back.\n\n $ npm install ender -g\n\nTo include Query in a custom build of Ender you can include it as such:\n\n $ ender build qwery[,mod2,mod3,...]\n\nOr add it to an existing Ender installation\n\n $ ender add qwery\n\nEnder bridge additions\n---------\nAssuming you already know the happs on Ender -- Qwery provides some additional niceties when included with Ender:\n\n``` js\n// the context finder - find all p elements descended from a div element\n$('div').find('p')\n\n// join one set with another\n$('div').and('p')\n\n// test nodes against selectors\n$('#foo').is('div.bar'); // => true if any nodes match\n\n// element creation\n$('<p>hello world</p>'); // => [HTMLParagraphElement \"hello world\"]\n```\nRecommended sibling modules\n----------\nIn most cases, if you're hunting for a selector engine, you probably want to pair Qwery with a DOM module. In that case qwery pairs quite nicely with [Bonzo](https://github.com/ded/bonzo) (a DOM util) and [Bean](https://github.com/fat/bean) (an event util). Add them to your Ender installation as such:\n\n $ ender -b qwery bonzo bean\n\nThen write code like a boss:\n\n``` js\n$('a.boosh')\n .css({\n color: 'red',\n background: 'white'\n })\n .after('√')\n .bind({\n 'click.button': function () {\n $(this).hide().unbind('click.button')\n }\n })\n```\n\nQwery Mobile!\n------------\nIf you're building a Webkit (iPhone / Android / Chrome OS) application, you may be interested in qwery-mobile! Include this (instead of qwery) in your Ender build and get a full qwery interface for just 600 bytes :)\n\n $ ender add qwery-mobile\n\nContributors\n-------\n * [Dustin Diaz](https://github.com/ded/qwery/commits/master?author=ded)\n * [Rod Vagg](https://github.com/ded/qwery/commits/master?author=rvagg)\n * [Jacob Thornton](https://github.com/ded/qwery/commits/master?author=fat)\n * [Andrew McCollum](https://github.com/ded/qwery/commits/master?author=amccollum)\n",
"_id": "qwery@3.3.11",
"_from": "qwery@*"
}