Permalink
Browse files

get headless phantom finally working

  • Loading branch information...
ded committed Nov 26, 2012
1 parent f7b7ce6 commit e0b349d4a61065482f5ef101afba7899648055a2
View
@@ -1,9 +1,6 @@
boosh:
- smoosh make ./config/smoosh.json
+ node_modules/smoosh/bin/smoosh make ./config/smoosh.json
cp src/ender.js mobile/ender.js
-install:
- npm install smoosh -g
-
test:
- serve . && phantomjs tests/phantom.js
+ node tests/test-env.js
View
@@ -26,7 +26,6 @@
, "sub": true
, "white": false
, "indent": 2
- , "whitespace": true
, "asi": true
, "laxbreak": true
, "eqeqeq": false
View
No changes.
View
@@ -1,7 +1,7 @@
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
- * copyright Dustin Diaz & Jacob Thornton 2012
+ * copyright Dustin Diaz 2012
* MIT License
*/
@@ -35,7 +35,8 @@
function uniq(ar) {
var a = [], i, j
- label: for (i = 0; i < ar.length; i++) {
+ label:
+ for (i = 0; i < ar.length; i++) {
for (j = 0; j < a.length; j++) {
if (a[j] == ar[i]) {
continue label

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -28,7 +28,8 @@
function uniq(ar) {
var a = [], i, j
- label: for (i = 0; i < ar.length; i++) {
+ label:
+ for (i = 0; i < ar.length; i++) {
for (j = 0; j < a.length; j++) {
if (a[j] == ar[i]) {
continue label
View
@@ -1,7 +1,7 @@
{
"name": "qwery"
, "description": "blazing fast CSS3 query selector engine"
- , "version": "3.3.11"
+ , "version": "3.4.0"
, "homepage": "https://github.com/ded/qwery"
, "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"
, "contributors": [
@@ -19,8 +19,7 @@
, "devDependencies": {
"sink-test": ">= 1.0.1"
, "serve": "*"
- }
- , "scripts": {
- "test": "phantomjs tests/phantom.js"
+ , "smoosh": "0.4.0"
+ , "phantomjs": "0.2.3"
}
}
View
@@ -1,7 +1,7 @@
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
- * copyright Dustin Diaz & Jacob Thornton 2012
+ * copyright Dustin Diaz 2012
* MIT License
*/
@@ -27,8 +27,8 @@
}
function checkNthExpr(el, nodes, a, b) {
- if (!a) return (nodes[b-1] == el)
- for (i = b, l = nodes.length; ((a > 0) ? (i <= l) : (i >= 1)); i += a) if (el == nodes[i-1]) return true
+ if (!a) return (nodes[b - 1] == el)
+ for (i = b, l = nodes.length; ((a > 0) ? (i <= l) : (i >= 1)); i += a) if (el == nodes[i - 1]) return true
return false
}
@@ -54,9 +54,9 @@
}
// *was* going to be in CSS3, didn't quite make it
- pseudos.contains = function(el, val) { return text(el).indexOf(val) != -1 }
+ pseudos.contains = function (el, val) { return text(el).indexOf(val) != -1 }
- pseudos.not = function(el, val) { return !q.is(el, val) }
+ pseudos.not = function (el, val) { return !q.is(el, val) }
pseudos['nth-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -20,8 +20,8 @@
}
function checkNthExpr(el, nodes, a, b) {
- if (!a) return (nodes[b-1] == el)
- for (i = b, l = nodes.length; ((a > 0) ? (i <= l) : (i >= 1)); i += a) if (el == nodes[i-1]) return true
+ if (!a) return (nodes[b - 1] == el)
+ for (i = b, l = nodes.length; ((a > 0) ? (i <= l) : (i >= 1)); i += a) if (el == nodes[i - 1]) return true
return false
}
@@ -47,9 +47,9 @@
}
// *was* going to be in CSS3, didn't quite make it
- pseudos.contains = function(el, val) { return text(el).indexOf(val) != -1 }
+ pseudos.contains = function (el, val) { return text(el).indexOf(val) != -1 }
- pseudos.not = function(el, val) { return !q.is(el, val) }
+ pseudos.not = function (el, val) { return !q.is(el, val) }
pseudos['nth-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
View
@@ -1,15 +1,15 @@
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
- * copyright Dustin Diaz & Jacob Thornton 2012
+ * copyright Dustin Diaz 2012
* MIT License
*/
-(function (name, definition, context) {
+(function (name, context, definition) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
- else if (typeof context['define'] == 'function' && context['define']['amd']) define(name, definition)
+ else if (typeof context['define'] == 'function' && context['define']['amd']) define(definition)
else context[name] = definition()
-})('qwery', function () {
+})('qwery', this, function () {
var doc = document
, html = doc.documentElement
, byClass = 'getElementsByClassName'
@@ -38,21 +38,22 @@
, dividers = new RegExp('(' + splitters.source + ')' + splittersMore.source, 'g')
, tokenizr = new RegExp(splitters.source + splittersMore.source)
, chunker = new RegExp(simple.source + '(' + attr.source + ')?' + '(' + pseudo.source + ')?')
- , walker = {
- ' ': function (node) {
- return node && node !== html && node.parentNode
- }
- , '>': function (node, contestant) {
- return node && node.parentNode == contestant.parentNode && node.parentNode
- }
- , '~': function (node) {
- return node && node.previousSibling
- }
- , '+': function (node, contestant, p1, p2) {
- if (!node) return false
- return (p1 = previous(node)) && (p2 = previous(contestant)) && p1 == p2 && p1
- }
+
+ var walker = {
+ ' ': function (node) {
+ return node && node !== html && node.parentNode
}
+ , '>': function (node, contestant) {
+ return node && node.parentNode == contestant.parentNode && node.parentNode
+ }
+ , '~': function (node) {
+ return node && node.previousSibling
+ }
+ , '+': function (node, contestant, p1, p2) {
+ if (!node) return false
+ return (p1 = previous(node)) && (p2 = previous(contestant)) && p1 == p2 && p1
+ }
+ }
function cache() {
this.c = {}
@@ -180,7 +181,7 @@
if (!tokens.length) return r
// filter further according to the rest of the selector (the left side)
- each(r, function(e) { if (ancestorMatch(e, tokens, dividedTokens)) ret[ret.length] = e })
+ each(r, function (e) { if (ancestorMatch(e, tokens, dividedTokens)) ret[ret.length] = e })
return ret
}
@@ -222,8 +223,9 @@
}
function uniq(ar) {
- var a = [], i, j
- o: for (i = 0; i < ar.length; ++i) {
+ var a = [], i, j;
+ o:
+ for (i = 0; i < ar.length; ++i) {
for (j = 0; j < a.length; ++j) if (a[j] == ar[i]) continue o
a[a.length] = ar[i]
}
@@ -270,15 +272,15 @@
// where the root is not document and a relationship selector is first we have to
// do some awkward adjustments to get it to work, even with qSA
function collectSelector(root, collector) {
- return function(s) {
+ return function (s) {
var oid, nid
if (splittable.test(s)) {
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
- collector(root.parentNode || root, s, true)
- oid || root.removeAttribute('id')
+ // 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
+ collector(root.parentNode || root, s, true)
+ oid || root.removeAttribute('id')
}
return;
}
@@ -298,16 +300,16 @@
while (element = element.parentNode) if (element === container) return 1
return 0
}
- , getAttr = function() {
+ , getAttr = function () {
// detect buggy IE src/href getAttribute() call
var e = doc.createElement('p')
return ((e.innerHTML = '<a href="#x">x</a>') && e.firstChild.getAttribute('href') != '#x') ?
- function(e, a) {
+ function (e, a) {
return a === 'class' ? e.className : (a === 'href' || a === 'src') ?
e.getAttribute(a, 2) : e.getAttribute(a)
} :
- function(e, a) { return e.getAttribute(a) }
- }()
+ function (e, a) { return e.getAttribute(a) }
+ }()
, hasByClass = !!doc[byClass]
// has native qSA support
, hasQSA = doc.querySelector && doc[qSA]
@@ -320,13 +322,13 @@
return arrayify(root[qSA](selector))
}
// special case where we need the services of `collectSelector()`
- each(ss = selector.split(','), collectSelector(root, function(ctx, s) {
+ each(ss = selector.split(','), collectSelector(root, function (ctx, s) {
e = ctx[qSA](s)
if (e.length == 1) result[result.length] = e.item(0)
else if (e.length) result = result.concat(arrayify(e))
}))
return ss.length > 1 && result.length > 1 ? uniq(result) : result
- } catch(ex) { }
+ } catch (ex) { }
return selectNonNative(selector, root)
}
// no native selector support
@@ -342,7 +344,7 @@
return result
}
// more complex selector, get `_qwery()` to do the work for us
- each(ss = selector.split(','), collectSelector(root, function(ctx, s, rewrite) {
+ 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]
@@ -364,4 +366,4 @@
qwery.pseudos = {}
return qwery
-}, this);
+});
Oops, something went wrong.

0 comments on commit e0b349d

Please sign in to comment.