Permalink
Browse files

- style modifications

- bump version for new configure() method in #68
- update readme
  • Loading branch information...
1 parent 452a183 commit 96dedfcbf049de702061faa7954fd8ded3ceb617 @ded committed Feb 7, 2012
Showing with 83 additions and 87 deletions.
  1. +7 −7 README.md
  2. +18 −18 mobile/ender.js
  3. +1 −1 package.json
  4. +19 −21 qwery.js
  5. +1 −1 qwery.min.js
  6. +18 −18 src/ender.js
  7. +19 −21 src/qwery.js
View
@@ -71,7 +71,7 @@ qwery.pseudos.foo = function (el, val) {
Configuring Qwery
-----------------
-The `configure()` method takes an options object allowing you to adjust the way that Qwery works internally. Currenly only the `useNativeQSA` option is available to turn on and off the use of native `querySelectorAll()` where available.
+The `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.
``` js
qwery.configure({
@@ -83,16 +83,16 @@ Browser Support
---------------
Qwery 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.
- - IE6, IE7, IE8, IE9
- - Chrome 1 - 12
- - Safari 3, 4, 5
- - Firefox 2, 3, 4, 5, Aurora
+ - IE6+
+ - Chrome 1+
+ - Safari 3+
+ - Firefox 2+
- Opera
Dev Env & Testing
-----
- $ npm install --dev
+ $ npm install smoosh sink-test
$ make
$ open tests/index.html
@@ -162,6 +162,6 @@ If you're building a Webkit (iPhone / Android / Chrome OS) application, you may
Contributors
-------
* [Dustin Diaz](https://github.com/ded/qwery/commits/master?author=ded)
- * [Jacob Thornton](https://github.com/ded/qwery/commits/master?author=fat)
* [Rod Vagg](https://github.com/ded/qwery/commits/master?author=rvagg)
+ * [Jacob Thornton](https://github.com/ded/qwery/commits/master?author=fat)
* [Andrew McCollum](https://github.com/ded/qwery/commits/master?author=amccollum)
View
@@ -20,29 +20,29 @@
}
$.ender({
- find: function (s) {
- var r = [], i, l, j, k, els
- for (i = 0, l = this.length; i < l; i++) {
- els = q(s, this[i])
- for (j = 0, k = els.length; j < k; j++) r.push(els[j])
+ find: function (s) {
+ var r = [], i, l, j, k, els
+ for (i = 0, l = this.length; i < l; i++) {
+ els = q(s, this[i])
+ for (j = 0, k = els.length; j < k; j++) r.push(els[j])
+ }
+ return $(q.uniq(r))
}
- return $(q.uniq(r))
- }
, and: function (s) {
- var plus = $(s)
- for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) {
- this[i] = plus[j]
+ var plus = $(s)
+ for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) {
+ this[i] = plus[j]
+ }
+ return this
}
- return this
- }
, is: function(s, r) {
- var i, l
- for (i = 0, l = this.length; i < l; i++) {
- if (q.is(this[i], s, r)) {
- return true
+ var i, l
+ for (i = 0, l = this.length; i < l; i++) {
+ if (q.is(this[i], s, r)) {
+ return true
+ }
}
+ return false
}
- return false
- }
}, true)
}(document, ender);
View
@@ -1,7 +1,7 @@
{
"name": "qwery"
, "description": "blazing fast CSS3 query selector engine"
- , "version": "3.3.2"
+ , "version": "3.3.3"
, "homepage": "https://github.com/ded/qwery"
, "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"
, "contributors": [
View
@@ -15,6 +15,10 @@
, byClass = 'getElementsByClassName'
, byTag = 'getElementsByTagName'
, qSA = 'querySelectorAll'
+ , useNativeQSA = 'useNativeQSA'
+ , tagName = 'tagName'
+ , nodeType = 'nodeType'
+ , select // main select() method, assign later
// OOOOOOOOOOOOH HERE COME THE ESSSXXSSPRESSSIONSSSSSSSS!!!!!
, id = /#([\w\-]+)/
@@ -50,8 +54,6 @@
return (p1 = previous(node)) && (p2 = previous(contestant)) && p1 == p2 && p1
}
}
- , useNativeQSA = 'useNativeQSA'
- , select // main select() method, assign later
function cache() {
this.c = {}
@@ -78,7 +80,7 @@
// not quite as fast as inline loops in older browsers so don't use liberally
function each(a, fn) {
var i = 0, l = a.length
- for (; i < l; i++) fn.call(null, a[i])
@rvagg

rvagg Feb 8, 2012

Collaborator

I feel so dirty and ashamed; nicely picked up

+ for (; i < l; i++) fn(a[i])
}
function flatten(ar) {
@@ -93,7 +95,7 @@
}
function previous(n) {
- while (n = n.previousSibling) if (n.nodeType == 1) break;
+ while (n = n.previousSibling) if (n[nodeType] == 1) break;
return n
}
@@ -106,17 +108,13 @@
// div.hello[title="world"]:foo('bar'), div, .hello, [title="world"], title, =, world, :foo('bar'), foo, ('bar'), bar]
function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value, wholePseudo, pseudo, wholePseudoVal, pseudoVal) {
var i, m, k, o, classes
- if (this.nodeType !== 1) return false
- if (tag && tag !== '*' && this.tagName && this.tagName.toLowerCase() !== tag) return false
+ if (this[nodeType] !== 1) return false
+ if (tag && tag !== '*' && this[tagName] && this[tagName].toLowerCase() !== tag) return false
if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) return false
if (idsAndClasses && (classes = idsAndClasses.match(clas))) {
- for (i = classes.length; i--;) {
- if (!classRegex(classes[i].slice(1)).test(this.className)) return false
- }
- }
- if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) {
- return false
+ for (i = classes.length; i--;) if (!classRegex(classes[i].slice(1)).test(this.className)) return false
}
+ if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) return false
if (wholeAttribute && !value) { // select is just for existance of attrib
o = this.attributes
for (k in o) {
@@ -168,10 +166,10 @@
intr = q(token)
// collect base candidates to filter
- els = root !== _root && root.nodeType !== 9 && dividedTokens && /^[+~]$/.test(dividedTokens[dividedTokens.length - 1]) ?
+ els = root !== _root && root[nodeType] !== 9 && dividedTokens && /^[+~]$/.test(dividedTokens[dividedTokens.length - 1]) ?
function (r) {
while (root = root.nextSibling) {
- root.nodeType == 1 && (intr[1] ? intr[1] == root.tagName.toLowerCase() : 1) && (r[r.length] = root)
+ root[nodeType] == 1 && (intr[1] ? intr[1] == root[tagName].toLowerCase() : 1) && (r[r.length] = root)
}
return r
}([]) :
@@ -221,7 +219,7 @@
}
function isNode(el, t) {
- return el && typeof el === 'object' && (t = el.nodeType) && (t == 1 || t == 9)
+ return el && typeof el === 'object' && (t = el[nodeType]) && (t == 1 || t == 9)
}
function uniq(ar) {
@@ -240,13 +238,13 @@
function normalizeRoot(root) {
if (!root) return doc
if (typeof root == 'string') return qwery(root)[0]
- if (!root.nodeType && arrayLike(root)) return root[0]
+ if (!root[nodeType] && arrayLike(root)) return root[0]
return root
}
function byId(root, id, el) {
// if doc, query on it, else query the parent doc or if a detached fragment rewrite the query and run on the fragment
- return root.nodeType === 9 ? root.getElementById(id) :
+ return root[nodeType] === 9 ? root.getElementById(id) :
root.ownerDocument &&
(((el = root.ownerDocument.getElementById(id)) && isAncestor(el, root) && el) ||
(!isAncestor(root, root.ownerDocument) && select('[id="' + id + '"]', root)[0]))
@@ -276,7 +274,7 @@
return function(s) {
var oid, nid
if (splittable.test(s)) {
- if (root.nodeType !== 9) {
+ if (root[nodeType] !== 9) {
// make sure the el has an id, rewrite the query, set root to doc and run it
if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')
s = '[id="' + nid + '"]' + s // avoid byId and allow us to match context element
@@ -294,7 +292,7 @@
return (container.compareDocumentPosition(element) & 16) == 16
} : 'contains' in html ?
function (element, container) {
- container = container.nodeType === 9 || container == window ? html : container
+ container = container[nodeType] === 9 || container == window ? html : container
return container !== element && container.contains(element)
} :
function (element, container) {
@@ -318,7 +316,7 @@
, selectQSA = function (selector, root) {
var result = [], ss, e
try {
- if (root.nodeType === 9 || !splittable.test(selector)) {
+ if (root[nodeType] === 9 || !splittable.test(selector)) {
// most work is done right here, defer to qSA
return arrayify(root[qSA](selector))
}
@@ -348,7 +346,7 @@
each(ss = selector.split(','), collectSelector(root, function(ctx, s, rewrite) {
r = _qwery(s, ctx)
for (i = 0, l = r.length; i < l; i++) {
- if (ctx.nodeType === 9 || rewrite || isAncestor(r[i], root)) result[result.length] = r[i]
+ if (ctx[nodeType] === 9 || rewrite || isAncestor(r[i], root)) result[result.length] = r[i]
}
}))
return ss.length > 1 && result.length > 1 ? uniq(result) : result
Oops, something went wrong.

0 comments on commit 96dedfc

Please sign in to comment.