Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

traversty

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

traversty - npm Package Compare versions

Comparing version
1.0.0
to
1.0.1
+92
test/integration/traversty_css_zest.html
<!doctype html>
<html>
<head>
<title>Traversty with Zest and css() augmentation Integration Test</title>
<script src="../../traversty.js"></script>
<script src="../vendor/zest.js"></script>
<script src="../../examples/aug-css.js"></script>
</head>
<body>
<h1>Traversty with Zest and css() augmentation Integration Test</h1>
<p>This is vanilla Traversty with Zest plugged in as <code>setSelectorEngine()</code> and a <code>css()</code> method added by using <code>aug()</code>. See the <i>/examples/aug-css.js</i> file for how this achieved.</p>
<div id="fixtures">
<ul>
<li>ONE (red)</li>
<li class="c">TWO</li>
<li>THREE (green)</li>
<li class="c">FOUR
<ul class="second">
<li>i</li>
<li class="c">ii</li>
<li>iii (blue)</li>
<li class="c">iv
<span class="c">SPAN (yellow)</span>
</li>
</ul>
</li>
<li class="c">FIVE (purple)</li>
</ul>
<ul>
<li>one (red)</li>
<li class="c">two</li>
<li>three (green)</li>
<li class="c">four
<ul class="second">
<li>1</li>
<li class="c">2</li>
<li>3 (blue)</li>
<li class="c">4
<span class="c">span (yellow)</span>
</li>
</ul>
</li>
<li class="c">five (purple)</li>
</ul>
</div>
<div id="reference">
<h2>Reference screenshot</h2>
<p>The above block should look similar to this:</p>
<img src="integration_reference.png" style="border: 1px solid rgb(100,100,100); box-shadow: 2px 2px 15px rgb(100,100,100);">
</div>
<p>See also:</p>
<ul>
<li><a href="ender_qwery.html">Traversty Ender (with Qwery) Integration Test</a></li>
<li><a href="ender_sel.html">Traversty Ender (with Sel) Integration Test</a></li>
<li><a href="ender_sizzle.html">Traversty Ender (with Sizzle) Integration Test</a></li>
<li><a href="ender_nwmatcher.html">Traversty Ender (with NWMatcher) Integration Test</a></li>
<li><a href="ender_noselector.html">Traversty Ender (with no selector engine) Integration Test</a></li>
</ul>
<script>
var $ = traversty
$.setSelectorEngine(zest)
$('#fixtures > ul')
.down(0).css('color', 'red')
.next('li', 1).css('color', 'green')
.next().down('li', 2).css('color', 'blue')
.next().down().css('color', 'yellow')
.up(2).next().css('color', 'purple')
.siblings(3).css('fontWeight', 'bold')
.children().css('textDecoration', 'underline')
.children(1).css('borderLeft', 'solid 5px red')
.parents('*').filter('ul').css('borderTop', 'dashed 2px green')
.not('.second').css('borderBottom', 'solid 3px blue')
.down('.second li').has('span').css('marginTop', '10px')
.up('ul').eq(-1).css('borderLeft', 'solid 5px orange')
.closest('#fixtures').down('li').slice(-10,-9).css('fontSize', '25px')
$.aug({ prepend: function (element) {
return this.each(function (el, i) {
el.insertBefore(i > 0 ? element.cloneNode(true) : element, el.firstChild)
})
}})
var div = document.createElement('div')
div.innerHTML = 'INTEGRATION TEST ALL DONE!'
if ($('li').is('.c') === true) $('#fixtures').prepend(div)
</script>
</body>
</html>
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2012
* MIT License
*/
!function () {
var q, pseudos, i, l, p, r, nodes, m, nthPattern = /\s*((?:\+|\-)?(\d*))n\s*((?:\+|\-)\s*\d+)?\s*/
if (typeof module != 'undefined' && typeof 'require' != 'undefined')
q = require('qwery')
else if (typeof qwery != 'undefined')
q = qwery
else
return
pseudos = q.pseudos
function children(node, ofType) {
var r = []
nodes = node.childNodes
for (i = 0, l = nodes.length; i < l; i++) {
if (nodes[i].nodeType == 1 && (!ofType || nodes[i].nodeName == ofType)) r.push(nodes[i])
}
return r
}
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
return false
}
function checkNth(el, nodes, val) {
if (isFinite(val)) return nodes[val - 1] == el
else if (val == 'odd') return checkNthExpr(el, nodes, 2, 1)
else if (val == 'even') return checkNthExpr(el, nodes, 2, 0)
else if (m = nthPattern.exec(val))
return checkNthExpr(el, nodes,
(m[2] ? parseInt(m[1], 10) : parseInt(m[1] + '1', 10)), // Check case where coefficient is omitted
(m[3] ? parseInt(m[3].replace(/\s*/, ''), 10) : 0)) // Check case where constant is omitted
return false
}
function text(el, s) {
if (el.nodeType === 3 || el.nodeType === 4) return el.nodeValue;
if (el.nodeType !== 1 && el.nodeType !== 9) return '';
for (s = '', el = el.firstChild; el; el = el.nextSibling) {
if (el.nodeType !== 8) s += el.textContent || el.innerText || text(el)
}
return s
}
// *was* going to be in CSS3, didn't quite make it
pseudos.contains = function(el, val) { return text(el).indexOf(val) != -1 }
pseudos.not = function(el, val) { return !q.is(el, val) }
pseudos['nth-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p), val)
}
pseudos['nth-last-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p).reverse(), val)
}
pseudos['nth-of-type'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p, el.nodeName), val)
}
pseudos['nth-last-of-type'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p, el.nodeName).reverse(), val)
}
pseudos['first-child'] = function (el) { return pseudos['nth-child'](el, 1) }
pseudos['last-child'] = function (el) { return pseudos['nth-last-child'](el, 1) }
pseudos['first-of-type'] = function (el) { return pseudos['nth-of-type'](el, 1) }
pseudos['last-of-type'] = function (el) { return pseudos['nth-last-of-type'](el, 1) }
pseudos['only-child'] = function (el) {
return (p = el.parentNode) && (nodes = children(p)) && (nodes.length == 1) && (el == nodes[0])
};
pseudos['only-of-type'] = function (el) {
return (p = el.parentNode) && (nodes = children(p, el.nodeName)) && (nodes.length == 1) && (el == nodes[0])
}
pseudos.target = function (el) {
return (el.getAttribute('id') == location.hash.substr(1))
}
pseudos.checked = function (el) { return el.checked }
pseudos.enabled = function (el) { return !el.disabled }
pseudos.disabled = function (el) { return el.disabled }
pseudos.empty = function (el) { return !el.childNodes.length }
}();
/**
* Zest (https://github.com/chjj/zest)
* A css selector engine.
* Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed)
*/
// TODO
// - Recognize the TR subject selector when parsing.
// - Pass context to scope.
// - Add :column pseudo-classes.
;(function() {
/**
* Shared
*/
var window = this
, document = this.document
, old = this.zest;
/**
* Helpers
*/
var compareDocumentPosition = (function() {
if (document.compareDocumentPosition) {
return function(a, b) {
return a.compareDocumentPosition(b);
};
}
return function(a, b) {
var el = a.ownerDocument.getElementsByTagName('*')
, i = el.length;
while (i--) {
if (el[i] === a) return 2;
if (el[i] === b) return 4;
}
return 1;
};
})();
var order = function(a, b) {
return compareDocumentPosition(a, b) & 2 ? 1 : -1;
};
var next = function(el) {
while ((el = el.nextSibling)
&& el.nodeType !== 1);
return el;
};
var prev = function(el) {
while ((el = el.previousSibling)
&& el.nodeType !== 1);
return el;
};
var child = function(el) {
if (el = el.firstChild) {
while (el.nodeType !== 1
&& (el = el.nextSibling));
}
return el;
};
var lastChild = function(el) {
if (el = el.lastChild) {
while (el.nodeType !== 1
&& (el = el.previousSibling));
}
return el;
};
var unquote = function(str) {
if (!str) return str;
var ch = str[0];
return ch === '"' || ch === '\''
? str.slice(1, -1)
: str;
};
var indexOf = (function() {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf;
}
return function(obj, item) {
var i = this.length;
while (i--) {
if (this[i] === item) return i;
}
return -1;
};
})();
var makeInside = function(start, end) {
var regex = rules.inside.source
.replace(/</g, start)
.replace(/>/g, end);
return new RegExp(regex);
};
var replace = function(regex, name, val) {
regex = regex.source;
regex = regex.replace(name, val.source || val);
return new RegExp(regex);
};
var truncateUrl = function(url, num) {
return url
.replace(/^(?:\w+:\/\/|\/+)/, '')
.replace(/(?:\/+|\/*#.*?)$/, '')
.split('/', num)
.join('/');
};
/**
* Handle `nth` Selectors
*/
var parseNth = function(param, test) {
var param = param.replace(/\s+/g, '')
, cap;
if (param === 'even') {
param = '2n+0';
} else if (param === 'odd') {
param = '2n+1';
} else if (!~param.indexOf('n')) {
param = '0n' + param;
}
cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param);
return {
group: cap[1] === '-'
? -(cap[2] || 1)
: +(cap[2] || 1),
offset: cap[4]
? (cap[3] === '-' ? -cap[4] : +cap[4])
: 0
};
};
var nth = function(param, test, last) {
var param = parseNth(param)
, group = param.group
, offset = param.offset
, find = !last ? child : lastChild
, advance = !last ? next : prev;
return function(el) {
if (el.parentNode.nodeType !== 1) return;
var rel = find(el.parentNode)
, pos = 0;
while (rel) {
if (test(rel, el)) pos++;
if (rel === el) {
pos -= offset;
return group && pos
? !(pos % group) && (pos < 0 === group < 0)
: !pos;
}
rel = advance(rel);
}
};
};
/**
* Simple Selectors
*/
var selectors = {
'*': (function() {
if (function() {
var el = document.createElement('div');
el.appendChild(document.createComment(''));
return !!el.getElementsByTagName('*')[0];
}()) {
return function(el) {
if (el.nodeType === 1) return true;
};
}
return function() {
return true;
};
})(),
'type': function(type) {
type = type.toLowerCase();
return function(el) {
return el.nodeName.toLowerCase() === type;
};
},
'attr': function(key, op, val, i) {
op = operators[op];
return function(el) {
var attr;
switch (key) {
case 'for':
attr = el.htmlFor;
break;
case 'class':
attr = el.className;
break;
case 'href':
attr = el.getAttribute('href', 2);
break;
case 'title':
attr = el.getAttribute('title') || null;
break;
case 'id':
if (el.getAttribute) {
attr = el.getAttribute('id');
break;
}
default:
attr = el[key] != null
? el[key]
: el.getAttribute && el.getAttribute(key);
break;
}
if (attr == null) return;
attr = attr + '';
if (i) {
attr = attr.toLowerCase();
val = val.toLowerCase();
}
return op(attr, val);
};
},
':first-child': function(el) {
return !prev(el) && el.parentNode.nodeType === 1;
},
':last-child': function(el) {
return !next(el) && el.parentNode.nodeType === 1;
},
':only-child': function(el) {
return !prev(el) && !next(el)
&& el.parentNode.nodeType === 1;
},
':nth-child': function(param, last) {
return nth(param, function() {
return true;
}, last);
},
':nth-last-child': function(param) {
return selectors[':nth-child'](param, true);
},
':root': function(el) {
return el.ownerDocument.documentElement === el;
},
':empty': function(el) {
return !el.firstChild;
},
':not': function(sel) {
var test = compileGroup(sel);
return function(el) {
return !test(el);
};
},
':first-of-type': function(el) {
if (el.parentNode.nodeType !== 1) return;
var type = el.nodeName;
while (el = prev(el)) {
if (el.nodeName === type) return;
}
return true;
},
':last-of-type': function(el) {
if (el.parentNode.nodeType !== 1) return;
var type = el.nodeName;
while (el = next(el)) {
if (el.nodeName === type) return;
}
return true;
},
':only-of-type': function(el) {
return selectors[':first-of-type'](el)
&& selectors[':last-of-type'](el);
},
':nth-of-type': function(param, last) {
return nth(param, function(rel, el) {
return rel.nodeName === el.nodeName;
}, last);
},
':nth-last-of-type': function(param) {
return selectors[':nth-of-type'](param, true);
},
':checked': function(el) {
return !!(el.checked || el.selected);
},
':indeterminate': function(el) {
return !selectors[':checked'](el);
},
':enabled': function(el) {
return !el.disabled && el.type !== 'hidden';
},
':disabled': function(el) {
return !!el.disabled;
},
':target': function(el) {
return el.id === window.location.hash.substring(1);
},
':focus': function(el) {
return el === el.ownerDocument.activeElement;
},
':matches': function(sel) {
return compileGroup(sel);
},
':nth-match': function(param, last) {
var args = param.split(/\s*,\s*/)
, arg = args.shift()
, test = compileGroup(args.join(','));
return nth(arg, test, last);
},
':nth-last-match': function(param) {
return selectors[':nth-match'](param, true);
},
':links-here': function(el) {
return el + '' === window.location + '';
},
':lang': function(param) {
return function(el) {
while (el) {
if (el.lang) return el.lang.indexOf(param) === 0;
el = el.parentNode;
}
};
},
':dir': function(param) {
return function(el) {
while (el) {
if (el.dir) return el.dir === param;
el = el.parentNode;
}
};
},
':scope': function(el, con) {
var context = con || el.ownerDocument;
if (context.nodeType === 9) {
return el === context.documentElement;
}
return el === context;
},
':any-link': function(el) {
return typeof el.href === 'string';
},
':local-link': function(el) {
if (el.nodeName) {
return el.href && el.host === window.location.host;
}
var param = +el + 1;
return function(el) {
if (!el.href) return;
var url = window.location + ''
, href = el + '';
return truncateUrl(url, param) === truncateUrl(href, param);
};
},
':default': function(el) {
return !!el.defaultSelected;
},
':valid': function(el) {
return el.willValidate || (el.validity && el.validity.valid);
},
':invalid': function(el) {
return !selectors[':valid'](el);
},
':in-range': function(el) {
return el.value > el.min && el.value <= el.max;
},
':out-of-range': function(el) {
return !selectors[':in-range'](el);
},
':required': function(el) {
return !!el.required;
},
':optional': function(el) {
return !el.required;
},
':read-only': function(el) {
if (el.readOnly) return true;
var attr = el.getAttribute('contenteditable')
, prop = el.contentEditable
, name = el.nodeName.toLowerCase();
name = name !== 'input' && name !== 'textarea';
return (name || el.disabled) && attr == null && prop !== 'true';
},
':read-write': function(el) {
return !selectors[':read-only'](el);
},
':hover': function() {
throw new Error(':hover is not supported.');
},
':active': function() {
throw new Error(':active is not supported.');
},
':link': function() {
throw new Error(':link is not supported.');
},
':visited': function() {
throw new Error(':visited is not supported.');
},
':column': function() {
throw new Error(':column is not supported.');
},
':nth-column': function() {
throw new Error(':nth-column is not supported.');
},
':nth-last-column': function() {
throw new Error(':nth-last-column is not supported.');
},
':current': function() {
throw new Error(':current is not supported.');
},
':past': function() {
throw new Error(':past is not supported.');
},
':future': function() {
throw new Error(':future is not supported.');
},
// Non-standard, for compatibility purposes.
':contains': function(param) {
return function(el) {
var text = el.innerText || el.textContent || el.value || '';
return !!~text.indexOf(param);
};
},
':has': function(param) {
return function(el) {
return zest(param, el).length > 0;
};
}
// Potentially add more pseudo selectors for
// compatibility with sizzle and most other
// selector engines (?).
};
/**
* Attribute Operators
*/
var operators = {
'-': function() {
return true;
},
'=': function(attr, val) {
return attr === val;
},
'*=': function(attr, val) {
return attr.indexOf(val) !== -1;
},
'~=': function(attr, val) {
var i = attr.indexOf(val)
, f
, l;
if (i === -1) return;
f = attr[i - 1];
l = attr[i + val.length];
return (!f || f === ' ') && (!l || l === ' ');
},
'|=': function(attr, val) {
var i = attr.indexOf(val)
, l;
if (i !== 0) return;
l = attr[i + val.length];
return l === '-' || !l;
},
'^=': function(attr, val) {
return attr.indexOf(val) === 0;
},
'$=': function(attr, val) {
return attr.indexOf(val) + val.length === attr.length;
},
// non-standard
'!=': function(attr, val) {
return attr !== val;
}
};
/**
* Combinator Logic
*/
var combinators = {
' ': function(test) {
return function(el) {
while (el = el.parentNode) {
if (test(el)) return el;
}
};
},
'>': function(test) {
return function(el) {
return test(el = el.parentNode) && el;
};
},
'+': function(test) {
return function(el) {
return test(el = prev(el)) && el;
};
},
'~': function(test) {
return function(el) {
while (el = prev(el)) {
if (test(el)) return el;
}
};
},
'noop': function(test) {
return function(el) {
return test(el) && el;
};
},
'ref': function(test, name) {
var node;
function ref(el) {
var doc = el.ownerDocument
, nodes = doc.getElementsByTagName('*')
, i = nodes.length;
while (i--) {
node = nodes[i];
if (ref.test(el)) {
node = null;
return true;
}
}
node = null;
}
ref.combinator = function(el) {
if (!node || !node.getAttribute) return;
var attr = node.getAttribute(name) || '';
if (attr[0] === '#') attr = attr.substring(1);
if (attr === el.id && test(node)) {
return node;
}
};
return ref;
}
};
/**
* Grammar
*/
var rules = {
qname: /^ *([\w\-]+|\*)/,
simple: /^(?:([.#][\w\-]+)|pseudo|attr)/,
ref: /^ *\/([\w\-]+)\/ */,
combinator: /^(?: +([^ \w*]) +|( )+|([^ \w*]))(?! *$)/,
attr: /^\[([\w\-]+)(?:([^\w]?=)(inside))?\]/,
pseudo: /^(:[\w\-]+)(?:\((inside)\))?/,
inside: /(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/
};
rules.inside = replace(rules.inside, '[^"\'>]*', rules.inside);
rules.attr = replace(rules.attr, 'inside', makeInside('\\[', '\\]'));
rules.pseudo = replace(rules.pseudo, 'inside', makeInside('\\(', '\\)'));
rules.simple = replace(rules.simple, 'pseudo', rules.pseudo);
rules.simple = replace(rules.simple, 'attr', rules.attr);
/**
* Compiling
*/
var compile = function(sel) {
var sel = sel.replace(/^\s+|\s+$/g, '')
, test
, filter = []
, buff = []
, subject
, qname
, cap
, op
, ref;
while (sel) {
if (cap = rules.qname.exec(sel)) {
sel = sel.substring(cap[0].length);
qname = cap[1];
buff.push(tok(qname, true));
} else if (cap = rules.simple.exec(sel)) {
sel = sel.substring(cap[0].length);
qname = '*';
buff.push(tok(qname, true));
buff.push(tok(cap));
} else {
throw new Error('Invalid selector.');
}
while (cap = rules.simple.exec(sel)) {
sel = sel.substring(cap[0].length);
buff.push(tok(cap));
}
if (sel[0] === '!') {
sel = sel.substring(1);
subject = makeSubject();
subject.qname = qname;
buff.push(subject.simple);
}
if (cap = rules.ref.exec(sel)) {
sel = sel.substring(cap[0].length);
ref = combinators.ref(makeSimple(buff), cap[1]);
filter.push(ref.combinator);
buff = [];
continue;
}
if (cap = rules.combinator.exec(sel)) {
sel = sel.substring(cap[0].length);
op = cap[1] || cap[2] || cap[3];
if (op === ',') {
filter.push(combinators.noop(makeSimple(buff)));
break;
}
} else {
op = 'noop';
}
filter.push(combinators[op](makeSimple(buff)));
buff = [];
}
test = makeTest(filter);
test.qname = qname;
test.sel = sel;
if (subject) {
subject.lname = test.qname;
subject.test = test;
subject.qname = subject.qname;
subject.sel = test.sel;
test = subject;
}
if (ref) {
ref.test = test;
ref.qname = test.qname;
ref.sel = test.sel;
test = ref;
}
return test;
};
var tok = function(cap, qname) {
// qname
if (qname) {
return cap === '*'
? selectors['*']
: selectors.type(cap);
}
// class/id
if (cap[1]) {
return cap[1][0] === '.'
? selectors.attr('class', '~=', cap[1].substring(1))
: selectors.attr('id', '=', cap[1].substring(1));
}
// pseudo-name
// inside-pseudo
if (cap[2]) {
return cap[3]
? selectors[cap[2]](unquote(cap[3]))
: selectors[cap[2]];
}
// attr name
// attr op
// attr value
if (cap[4]) {
var i;
if (cap[6]) {
i = cap[6].length;
cap[6] = cap[6].replace(/ +i$/, '');
i = i > cap[6].length;
}
return selectors.attr(cap[4], cap[5] || '-', unquote(cap[6]), i);
}
throw new Error('Unknown Selector.');
};
var makeSimple = function(func) {
var l = func.length
, i;
// Potentially make sure
// `el` is truthy.
if (l < 2) return func[0];
return function(el) {
if (!el) return;
for (i = 0; i < l; i++) {
if (!func[i](el)) return;
}
return true;
};
};
var makeTest = function(func) {
if (func.length < 2) {
return function(el) {
return !!func[0](el);
};
}
return function(el) {
var i = func.length;
while (i--) {
if (!(el = func[i](el))) return;
}
return true;
};
};
var makeSubject = function() {
var target;
function subject(el) {
var node = el.ownerDocument
, scope = node.getElementsByTagName(subject.lname)
, i = scope.length;
while (i--) {
if (subject.test(scope[i]) && target === el) {
target = null;
return true;
}
}
target = null;
}
subject.simple = function(el) {
target = el;
return true;
};
return subject;
};
var compileGroup = function(sel) {
var test = compile(sel)
, tests = [ test ];
while (test.sel) {
test = compile(test.sel);
tests.push(test);
}
if (tests.length < 2) return test;
return function(el) {
var l = tests.length
, i = 0;
for (; i < l; i++) {
if (tests[i](el)) return true;
}
};
};
/**
* Selection
*/
var find = function(sel, node) {
var results = []
, test = compile(sel)
, scope = node.getElementsByTagName(test.qname)
, i = 0
, el;
while (el = scope[i++]) {
if (test(el)) results.push(el);
}
if (test.sel) {
while (test.sel) {
test = compile(test.sel);
scope = node.getElementsByTagName(test.qname);
i = 0;
while (el = scope[i++]) {
if (test(el) && !~indexOf.call(results, el)) {
results.push(el);
}
}
}
results.sort(order);
}
return results;
};
/**
* Native
*/
var select = (function() {
var slice = (function() {
try {
Array.prototype.slice.call(document.getElementsByTagName('*'));
return Array.prototype.slice;
} catch(e) {
e = null;
return function() {
var a = [], i = 0, l = this.length;
for (; i < l; i++) a.push(this[i]);
return a;
};
}
})();
if (document.querySelectorAll) {
return function(sel, node) {
try {
return slice.call(node.querySelectorAll(sel));
} catch(e) {
return find(sel, node);
}
};
}
return function(sel, node) {
try {
if (sel[0] === '#' && /^#[\w\-]+$/.test(sel)) {
return [node.getElementById(sel.substring(1))];
}
if (sel[0] === '.' && /^\.[\w\-]+$/.test(sel)) {
sel = node.getElementsByClassName(sel.substring(1));
return slice.call(sel);
}
if (/^[\w\-]+$/.test(sel)) {
return slice.call(node.getElementsByTagName(sel));
}
} catch(e) {
;
}
return find(sel, node);
};
})();
/**
* Zest
*/
var zest = function(sel, node) {
try {
sel = select(sel, node || document);
} catch(e) {
if (window.ZEST_DEBUG) {
console.log(e.stack || e + '');
}
sel = [];
}
return sel;
};
/**
* Expose
*/
zest.selectors = selectors;
zest.operators = operators;
zest.combinators = combinators;
zest.compile = compileGroup;
zest.matches = function(el, sel) {
return !!compileGroup(sel)(el);
};
zest.cache = function() {
if (compile.raw) return;
var raw = compile
, cache = {};
compile = function(sel) {
return cache[sel]
|| (cache[sel] = raw(sel));
};
compile.raw = raw;
zest._cache = cache;
};
zest.noCache = function() {
if (!compile.raw) return;
compile = compile.raw;
delete zest._cache;
};
zest.noConflict = function() {
window.zest = old;
return zest;
};
zest.noNative = function() {
select = find;
};
if (typeof module !== 'undefined') {
module.exports = zest;
} else {
this.zest = zest;
}
if (window.ZEST_DEBUG) {
zest.noNative();
} else {
zest.cache();
}
}).call(function() {
return this || (typeof window !== 'undefined' ? window : global);
}());
+1
-0

@@ -10,2 +10,3 @@ var config = module.exports

, './test/vendor/nwmatcher.js'
, './test/vendor/zest.js'
, './test/vendor/es5-basic_mod.js'

@@ -12,0 +13,0 @@ , './test/vendor/sel.js'

+1
-1
{
"name" : "traversty"
, "description" : "Library agnostic utility for DOM collection management and traversal"
, "version" : "1.0.0"
, "version" : "1.0.1"
, "homepage" : "https://github.com/rvagg/traversty"

@@ -6,0 +6,0 @@ , "authors" : [

@@ -518,3 +518,3 @@ # Traversty &mdash; headache-free DOM collection management and traversal

Traversty allows you to plug in your favourite selector engine so it can work on whatever browsers your engine supports. Traversty is tested to support [Qwery](https://github.com/ded/qwery), [Sel](https://github.com/amccollum/sel), [Sizzle](https://github.com/jquery/sizzle) and [NWMatcher](https://github.com/dperini/nwmatcher).
Traversty allows you to plug in your favourite selector engine so it can work on whatever browsers your engine supports. Traversty is tested to support [Qwery](https://github.com/ded/qwery), [Sel](https://github.com/amccollum/sel), [Sizzle](https://github.com/jquery/sizzle), [NWMatcher](https://github.com/dperini/nwmatcher) and [Zest](https://github.com/chjj/zest).

@@ -543,7 +543,14 @@ Traversty uses *feature detection* to figure out how to use your selector engine, it tries to find the method used to *find* elements given a element root and the method used to determine if an element *matches* a given selector. If it can't figure out how to use your selector engine then you just need to pretend that it works like one of the supported ones and it should be OK.

You'll have to make do with the integration tests. [Here](http://rvagg.github.com/traversty/test/integration/ender_qwery.html) is Traversty running in an Ender build with Qwery and Bonzo. You can also see it running with [Sel](http://rvagg.github.com/traversty/test/integration/ender_sel.html), [Sizzle](http://rvagg.github.com/traversty/test/integration/ender_sizzle.html), [NWMatcher](http://rvagg.github.com/traversty/test/integration/ender_nwmatcher.html) and [without a selector engine](http://rvagg.github.com/traversty/test/integration/ender_sel.html) (works in modern browsers, including IE9+).
You'll have to make do with the integration tests:
### Ender
[Here](http://rvagg.github.com/traversty/test/integration/ender_qwery.html) is Traversty running in an Ender build with Qwery and Bonzo. You can also see it running with [Sel](http://rvagg.github.com/traversty/test/integration/ender_sel.html), [Sizzle](http://rvagg.github.com/traversty/test/integration/ender_sizzle.html), [NWMatcher](http://rvagg.github.com/traversty/test/integration/ender_nwmatcher.html) and [without a selector engine](http://rvagg.github.com/traversty/test/integration/ender_sel.html) (works in modern browsers, including IE9+).
View-source to see what it's doing, note that it's operating on 2 lists at the same time.
### Vanilla
[Here](https://github.com/rvagg/traversty/blob/master/test/integration/traversty_css_qwery.html) is Traversty bundled with Qwery as the selector engine and the `css()` augmenting example code [/examples/aug-css.js](https://github.com/rvagg/traversty/blob/master/examples/aug-css.js) performing the same integration tests. There is also the same example using Zest instead [here](https://github.com/rvagg/traversty/blob/master/test/integration/traversty_css_zest.html)
## Things to note

@@ -550,0 +557,0 @@

@@ -1,2 +0,2 @@

/*global traversalTests:true, filterTests:true, buster:true, T:true, Q:true, Sizzle:true, NW:true, sel:true, loadES5Basic:true, __matchesSelector:true*/
/*global traversalTests:true, filterTests:true, buster:true, T:true, Q:true, Sizzle:true, NW:true, zest:true, sel:true, loadES5Basic:true, __matchesSelector:true*/

@@ -47,8 +47,9 @@ var own = Object.prototype.hasOwnProperty

// we also don't want to run native tests in older browsers that don't support it
if (__matchesSelector) engineTest(null, 'Native')
if (window.__matchesSelector) engineTest(null, 'Native')
engineTest(Q, 'Qwery')
engineTest(Sizzle, 'Sizzle')
engineTest(NW.Dom, 'NW')
engineTest(zest, 'Zest')
// Sel must be last because it requires es5-basic which extends natives and we don't
// want that impacting any other tests in unexpected ways
engineTest(sel, 'Sel', function() { loadES5Basic() })

@@ -15,2 +15,3 @@ <!DOCTYPE HTML>

<script src="vendor/nwmatcher.js"></script>
<script src="vendor/zest.js"></script>
<script src="vendor/es5-basic_mod.js"></script>

@@ -17,0 +18,0 @@ <script src="vendor/sel.js"></script>

@@ -5,3 +5,3 @@ /*!

* Build: ender build domready bonzo ../.. --output ender_noselector
* Packages: ender-js@0.4.4 domready@0.2.11 bonzo@1.2.4 traversty@0.0.7
* Packages: ender-js@0.4.4 domready@0.2.11 bonzo@1.2.7-1 traversty@1.0.0
* =============================================================

@@ -989,4 +989,8 @@ */

, offset: function (opt_x, opt_y) {
if (typeof opt_x == 'number' || typeof opt_y == 'number') {
if (opt_x && typeof opt_x == 'object' && (typeof opt_x.top == 'number' || typeof opt_x.left == 'number')) {
return this.each(function (el) {
xy(el, opt_x.left, opt_x.top)
})
} else if (typeof opt_x == 'number' || typeof opt_y == 'number') {
return this.each(function (el) {
xy(el, opt_x, opt_y)

@@ -1002,16 +1006,10 @@ })

var el = this[0]
, de = el.ownerDocument.documentElement
, bcr = el.getBoundingClientRect()
, scroll = getWindowScroll()
, width = el.offsetWidth
, height = el.offsetHeight
, top = el.offsetTop
, left = el.offsetLeft
while (el = el.offsetParent) {
top = top + el.offsetTop
left = left + el.offsetLeft
, top = bcr.top + scroll.y - Math.max(0, de && de.clientTop, doc.body.clientTop)
, left = bcr.left + scroll.x - Math.max(0, de && de.clientLeft, doc.body.clientLeft)
if (el != doc.body) {
top -= el.scrollTop
left -= el.scrollLeft
}
}
return {

@@ -1143,6 +1141,3 @@ top: top

this.deepEach(clearData)
return this.each(function (el) {
el[parentNode] && el[parentNode].removeChild(el)
})
return this.detach()
}

@@ -1170,3 +1165,3 @@

return this.each(function (el) {
el[parentNode].removeChild(el)
el[parentNode] && el[parentNode].removeChild(el)
})

@@ -1500,3 +1495,4 @@ }

, toString = Object.prototype.toString
, slice = Array.prototype.slice
, Ap = Array.prototype
, slice = Ap.slice
// feature test to find native matchesSelector()

@@ -1508,2 +1504,4 @@ , matchesSelector = (function (el, pfx, name, i, ms) {

, Kfalse = function () { return false }
, isNumber = function (o) {

@@ -1624,3 +1622,3 @@ return toString.call(o) === '[object Number]'

if (isElement(el)
&& (!filterFn || (filterFn === true || filterFn(el, elind)))
&& (!filterFn || filterFn === true || filterFn(el, elind))
&& selectorMatches(selector, el)

@@ -1664,3 +1662,3 @@ && (index === null || i-- === 0)) {

? function (el) { return selectorMatches(slfn, el) }
: function () { return false }
: Kfalse
}

@@ -1754,5 +1752,9 @@

, eq: function (index) {
return traversty((index = eqIndex(this.length, index, 0)) === null ? [] : this[index])
return traversty(this.get(index))
}
, get: function (index) {
return this[eqIndex(this.length, index, 0)]
}
// a crazy man wrote this, don't try to understand it, see the tests

@@ -1777,11 +1779,2 @@ , slice: function (start, end) {

// same as filter() but return a boolean so quick-return after first successful find
, is: function (slfn) {
var i = 0, l = this.length
, fn = filterFn(slfn)
for (; i < l; i++)
if (fn(this[i], i)) return true
return false
}
// similar to filter() but cares about descendent elements

@@ -1795,6 +1788,32 @@ , has: function (slel) {

? function (el) { return selectorFind(slel, el).length } //TODO: performance
: function () { return false }
: Kfalse
))
}
// same as filter() but return a boolean so quick-return after first successful find
, is: function (slfn) {
var i = 0, l = this.length
, fn = filterFn(slfn)
for (; i < l; i++)
if (fn(this[i], i)) return true
return false
}
, toArray: function () { return Ap.slice.call(this) }
, size: function () { return this.length }
, each: function (fn, ctx) {
var i = 0, l = this.length
for (; i < l; i++)
fn.call(ctx || this[i], this[i], i, this)
return this
}
// quack like a duck (Array)
, push: Ap.push
, sort: Ap.sort
, splice: Ap.splice
}
T.prototype.prev = T.prototype.previous

@@ -1806,2 +1825,14 @@

// extend traversty functionality with custom methods
t.aug = function (methods) {
var key, method
for (key in methods) {
method = methods[key]
if (typeof method == 'function') {
T.prototype[key] = method
}
}
}
t.setSelectorEngine = function (s) {

@@ -1808,0 +1839,0 @@ // feature testing the selector engine like a boss

@@ -6,4 +6,4 @@ <!doctype html>

<script src="../../traversty.js"></script>
<script src="qwery.js"></script>
<script src="qwery-pseudos.js"></script>
<script src="../vendor/qwery.js"></script>
<script src="../vendor/qwery-pseudos.js"></script>
<script src="../../examples/aug-css.js"></script>

@@ -10,0 +10,0 @@ </head>

/*global qwery:true, traversty:true, buster:true*/
this.Q = qwery.noConflict()
this.Q = qwery
this.T = traversty.noConflict()

@@ -5,0 +5,0 @@ this.__matchesSelector = (function (el, pfx, name, i, ms) {

/*!
* Qwery - A Blazing Fast query selector engine
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2011
* copyright Dustin Diaz & Jacob Thornton 2012
* MIT License
*/
!function (name, definition) {
if (typeof module != 'undefined') module.exports = definition()
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition)
else this[name] = definition()
}('qwery', function () {
var context = this
, doc = document
, old = context.qwery
(function (name, definition, context) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
else if (typeof context['define'] == 'function' && context['define']['amd']) define(name, definition)
else context[name] = definition()
})('qwery', function () {
var doc = document
, html = doc.documentElement

@@ -20,2 +18,7 @@ , byClass = 'getElementsByClassName'

, qSA = 'querySelectorAll'
, useNativeQSA = 'useNativeQSA'
, tagName = 'tagName'
, nodeType = 'nodeType'
, select // main select() method, assign later
, id = /#([\w\-]+)/

@@ -27,3 +30,2 @@ , clas = /\.[\w\-]+/g

, tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/
, easy = new RegExp(idOnly.source + '|' + tagOnly.source + '|' + classOnly.source)
, splittable = /(^|,)\s*[>~+]/

@@ -36,10 +38,7 @@ , normalizr = /^\s+|\s*([,\s\+\~>]|$)\s*/g

, attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/
, pseudo = /:([\w\-]+)(\(['"]?([\s\w\+\-]+)['"]?\))?/
, pseudo = /:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/
, easy = new RegExp(idOnly.source + '|' + tagOnly.source + '|' + classOnly.source)
, dividers = new RegExp('(' + splitters.source + ')' + splittersMore.source, 'g')
, tokenizr = new RegExp(splitters.source + splittersMore.source)
, chunker = new RegExp(simple.source + '(' + attr.source + ')?' + '(' + pseudo.source + ')?')
// check if we can pass a selector to a non-CSS3 compatible qSA.
// *not* suitable for validating a selector, it's too lose; it's the users' responsibility to pass valid selectors
// this regex must be kept in sync with the one in tests.js
, css2 = /^(([\w\-]*[#\.]?[\w\-]+|\*)?(\[[\w\-]+([\~\|]?=['"][ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+["'])?\])?(\:(link|visited|active|hover))?([\s>+~\.,]|(?:$)))+$/
, walker = {

@@ -65,8 +64,9 @@ ' ': function (node) {

cache.prototype = {
g: function (k) {
return this.c[k] || undefined
}
, s: function (k, v) {
return (this.c[k] = v)
}
g: function (k) {
return this.c[k] || undefined
}
, s: function (k, v, r) {
v = r ? new RegExp(v) : v
return (this.c[k] = v)
}
}

@@ -80,3 +80,3 @@

function classRegex(c) {
return classCache.g(c) || classCache.s(c, new RegExp('(^|\\s+)' + c + '(\\s+|$)'));
return classCache.g(c) || classCache.s(c, '(^|\\s+)' + c + '(\\s+|$)', 1)
}

@@ -87,11 +87,7 @@

var i = 0, l = a.length
for (; i < l; i++) fn.call(null, a[i])
for (; i < l; i++) fn(a[i])
}
function flatten(ar) {
var r = []
each(ar, function(a) {
if (arrayLike(a)) r = r.concat(a)
else r[r.length] = a
});
for (var r = [], i = 0, l = ar.length; i < l; ++i) arrayLike(ar[i]) ? (r = r.concat(ar[i])) : (r[r.length] = ar[i])
return r

@@ -107,3 +103,3 @@ }

function previous(n) {
while (n = n.previousSibling) if (n.nodeType == 1) break;
while (n = n.previousSibling) if (n[nodeType] == 1) break;
return n

@@ -121,13 +117,9 @@ }

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
}
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 (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) return false
if (wholeAttribute && !value) { // select is just for existance of attrib

@@ -157,11 +149,11 @@ o = this.attributes

case '^=':
return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, new RegExp('^' + clean(val))))
return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, '^' + clean(val), 1))
case '$=':
return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, new RegExp(clean(val) + '$')))
return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, clean(val) + '$', 1))
case '*=':
return actual.match(attrCache.g(val) || attrCache.s(val, new RegExp(clean(val))))
return actual.match(attrCache.g(val) || attrCache.s(val, clean(val), 1))
case '~=':
return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, new RegExp('(?:^|\\s+)' + clean(val) + '(?:\\s+|$)')))
return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, '(?:^|\\s+)' + clean(val) + '(?:\\s+|$)', 1))
case '|=':
return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, new RegExp('^' + clean(val) + '(-|$)')))
return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, '^' + clean(val) + '(-|$)', 1))
}

@@ -185,6 +177,6 @@ return 0

// 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)
}

@@ -228,3 +220,3 @@ return r

while (p = walker[dividedTokens[i]](p, e)) {
if (isNode(p) && (found = interpret.apply(p, q(tokens[i])))) {
if (isNode(p) && (interpret.apply(p, q(tokens[i])))) {
if (i) {

@@ -239,13 +231,10 @@ if (cand = crawl(p, i - 1, p)) return cand

function isNode(el) {
return el && typeof el === 'object' && el.nodeType && (el.nodeType == 1 || el.nodeType == 9)
function isNode(el, t) {
return el && typeof el === 'object' && (t = el[nodeType]) && (t == 1 || t == 9)
}
function uniq(ar) {
var a = [], i, j;
label:
for (i = 0; i < ar.length; i++) {
for (j = 0; j < a.length; j++) {
if (a[j] == ar[i]) continue label;
}
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]

@@ -263,3 +252,3 @@ }

if (typeof root == 'string') return qwery(root)[0]
if (arrayLike(root)) return root[0]
if (!root[nodeType] && arrayLike(root)) return root[0]
return root

@@ -270,3 +259,3 @@ }

// 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 &&

@@ -289,3 +278,3 @@ (((el = root.ownerDocument.getElementById(id)) && isAncestor(el, root) && el) ||

if (m[2]) return arrayify(root[byTag](m[2]))
if (supportsCSS3 && m[3]) return arrayify(root[byClass](m[3]))
if (hasByClass && m[3]) return arrayify(root[byClass](m[3]))
}

@@ -302,3 +291,3 @@

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

@@ -321,3 +310,3 @@ if (!(nid = oid = root.getAttribute('id'))) root.setAttribute('id', nid = '__qwerymeupscotty')

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)

@@ -339,18 +328,10 @@ } :

}()
// does native qSA support CSS3 level selectors
, supportsCSS3 = function () {
if (doc[byClass] && doc.querySelector && doc[qSA]) {
try {
var p = doc.createElement('p')
p.innerHTML = '<a/>'
return p[qSA](':nth-of-type(1)').length
} catch (e) { }
}
return false
}()
// native support for CSS3 selectors
, selectCSS3 = function (selector, root) {
, hasByClass = !!doc[byClass]
// has native qSA support
, hasQSA = doc.querySelector && doc[qSA]
// use native qSA
, 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

@@ -369,17 +350,2 @@ return arrayify(root[qSA](selector))

}
// native support for CSS2 selectors only
, selectCSS2qSA = function (selector, root) {
var i, r, l, ss, result = []
selector = selector.replace(normalizr, '$1')
// safe to pass whole selector to qSA
if (!splittable.test(selector) && css2.test(selector)) return arrayify(root[qSA](selector))
each(ss = selector.split(','), collectSelector(root, function(ctx, s, rewrite) {
// use native qSA if selector is compatile, otherwise use _qwery()
r = css2.test(s) ? ctx[qSA](s) : _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]
}
}))
return ss.length > 1 && result.length > 1 ? uniq(result) : result
}
// no native selector support

@@ -401,3 +367,3 @@ , selectNonNative = function (selector, root) {

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]
}

@@ -407,4 +373,11 @@ }))

}
, select = supportsCSS3 ? selectCSS3 : doc[qSA] ? selectCSS2qSA : selectNonNative
, configure = function (options) {
// configNativeQSA: use fully-internal selector or native qSA where present
if (typeof options[useNativeQSA] !== 'undefined')
select = !options[useNativeQSA] ? selectNonNative : hasQSA ? selectQSA : selectNonNative
}
configure({ useNativeQSA: true })
qwery.configure = configure
qwery.uniq = uniq

@@ -414,8 +387,3 @@ qwery.is = is

qwery.noConflict = function () {
context.qwery = old
return this
}
return qwery
})
}, this);

@@ -1,3 +0,4 @@

/**************************************************************
* Traversty: DOM Traversal Utility (c) Rod Vagg (@rvagg) 2012
/***************************************************************
* Traversty: A DOM collection management and traversal utility
* (c) Rod Vagg (@rvagg) 2012
* https://github.com/rvagg/traversty

@@ -362,8 +363,17 @@ * License: MIT

try {
// YO! I HEARD YOU LIKED NESTED TERNARY OPERATORS SO I COOKED SOME UP FOR YOU!
// (one day I might loop this...)
// check to see how we do a matchesSelector
_selectorMatches =
isFunction(s.matching) ? function (selector, el) { return s.matching([el], selector).length > 0 } :
isFunction(s.is) ? function (selector, el) { return s.is(el, selector) } :
isFunction(s.matchesSelector) ? function (selector, el) { return s.matchesSelector(el, selector) } :
isFunction(s.match) ? function (selector, el) { return s.match(el, selector) } : null
_selectorMatches = isFunction(s.matching)
? function (selector, el) { return s.matching([el], selector).length > 0 }
: isFunction(s.is)
? function (selector, el) { return s.is(el, selector) }
: isFunction(s.matchesSelector)
? function (selector, el) { return s.matchesSelector(el, selector) }
: isFunction(s.match)
? function (selector, el) { return s.match(el, selector) }
: isFunction(s.matches)
? function (selector, el) { return s.matches(el, selector) }
: null

@@ -373,8 +383,15 @@ if (!_selectorMatches) {

ss = s('a', e)
_selectorMatches =
isFunction(ss._is) ? function (selector, el) { return s(el)._is(selector) } : // original .is(), replaced by Enderbridge
isFunction(ss.matching) ? function (selector, el) { return s(el).matching(selector).length > 0 } :
isFunction(ss.is) && !ss.is.__ignore ? function (selector, el) { return s(el).is(selector) } :
isFunction(ss.matchesSelector) ? function (selector, el) { return s(el).matchesSelector(selector) } :
isFunction(ss.match) ? function (selector, el) { return s(el).match(selector) } : null
_selectorMatches = isFunction(ss._is)
? function (selector, el) { return s(el)._is(selector) } // original .is(), replaced by Enderbridge
: isFunction(ss.matching)
? function (selector, el) { return s(el).matching(selector).length > 0 }
: isFunction(ss.is) && !ss.is.__ignore
? function (selector, el) { return s(el).is(selector) }
: isFunction(ss.matchesSelector)
? function (selector, el) { return s(el).matchesSelector(selector) }
: isFunction(ss.match)
? function (selector, el) { return s(el).match(selector) }
: isFunction(ss.matches)
? function (selector, el) { return s(el).matches(selector) }
: null
}

@@ -417,2 +434,2 @@

return traversty
}));
}));

@@ -1,5 +0,6 @@

/**************************************************************
* Traversty: DOM Traversal Utility (c) Rod Vagg (@rvagg) 2012
/***************************************************************
* Traversty: A DOM collection management and traversal utility
* (c) Rod Vagg (@rvagg) 2012
* https://github.com/rvagg/traversty
* License: MIT
*/!function(e,t){typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(e,t):this[e]=t()}("traversty",function(){var e=this,t=e.traversty,n=window.document,r=n.documentElement,i=Object.prototype.toString,s=Array.prototype,o=s.slice,u=function(e,t,n,r,i){while(r<t.length)if(e[i=t[r++]+n])return i}(r,["msM","webkitM","mozM","oM","m"],"atchesSelector",0),a=function(){return!1},f=function(e){return i.call(e)==="[object Number]"},l=function(e){return i.call(e)==="[object String]"},c=function(e){return i.call(e)==="[object Function]"},h=function(e){return e===void 0},p=function(e){return e&&e.nodeType===1},d=function(e,t){return h(e)&&!f(t)?0:f(e)?e:f(t)?t:null},v=function(e){return l(e)?e:"*"},m=function(e,t){return o.call(t.querySelectorAll(e),0)},g=function(e,t){return e==="*"||t[u](e)},y=m,b=g,w=function(e,t){return function(n,r){if(/,/.test(n)){var i=[],s=-1,o=r.getElementsByTagName("*");while(++s<o.length)p(o[s])&&t(n,o[s])&&i.push(o[s]);return i}return e(n,r)}},E="compareDocumentPosition"in r?function(e,t){return(t.compareDocumentPosition(e)&16)==16}:"contains"in r?function(e,t){return t=t.nodeType===9||t==window?r:t,t!==e&&t.contains(e)}:function(e,t){while(e=e.parentNode)if(e===t)return 1;return 0},S=function(e){var t=[],n=-1,r,i;while(++n<e.length){r=-1,i=!1;while(++r<t.length)if(t[r]===e[n]){i=!0;break}i||t.push(e[n])}return t},x=function(e,t){var n=[],r,i=0,s,o=e.length,u;while(i<o){s=0,u=(r=t(e[i],i++)).length;while(s<u)n.push(r[s++])}return n},T=function(e,t,n,r,i){return r=d(n,r),n=v(n),x(e,function(e,s){var o=r||0,u=[];i||(e=e[t]);while(e&&(r===null||o>=0))p(e)&&(!i||i===!0||i(e,s))&&b(n,e)&&(r===null||o--===0)&&(r===null&&t!=="nextSibling"?u=[e].concat(u):u.push(e)),e=e[t];return u})},N=function(e,t,n){return t<0&&(t=e+t),t<0||t>=e?null:!t&&t!==0?n:t},C=function(e,t){var n=[],r=0,i=e.length;for(;r<i;r++)t(e[r],r)&&n.push(e[r]);return n},k=function(e){var t;return p(e)?function(t){return t===e}:(t=typeof e)=="function"?function(t,n){return e.call(t,n)}:t=="string"&&e.length?function(t){return b(e,t)}:a},L=function(e){return function(){return!e.apply(this,arguments)}},A=function(){function r(e){this.length=0;if(e){e=S(!e.nodeType&&!h(e.length)?e:[e]);var t=this.length=e.length;while(t--)this[t]=e[t]}}function i(e){return new r(l(e)?y(e,n):e)}return r.prototype={down:function(e,t){return t=d(e,t),e=v(e),A(x(this,function(n){var r=y(e,n);return t===null?r:[r[t]]||[]}))},up:function(e,t){return A(T(this,"parentNode",e,t))},parents:function(){return r.prototype.up.apply(this,arguments.length?arguments:["*"])},closest:function(e,t){if(f(e))t=e,e="*";else{if(!l(e))return A([]);f(t)||(t=0)}return A(T(this,"parentNode",e,t,!0))},previous:function(e,t){return A(T(this,"previousSibling",e,t))},next:function(e,t){return A(T(this,"nextSibling",e,t))},siblings:function(e,t){var n=this,r=o.call(this,0),i=0,s=r.length;for(;i<s;i++){r[i]=r[i].parentNode.firstChild;while(!p(r[i]))r[i]=r[i].nextSibling}return h(e)&&(e="*"),A(T(r,"nextSibling",e||"*",t,function(e,t){return e!==n[t]}))},children:function(e,t){return A(T(r.prototype.down.call(this),"nextSibling",e||"*",t,!0))},first:function(){return r.prototype.eq.call(this,0)},last:function(){return r.prototype.eq.call(this,-1)},eq:function(e){return A(this.get(e))},get:function(e){return this[N(this.length,e,0)]},slice:function(e,t){var n=t,r=this.length,i=[];e=N(r,Math.max(-this.length,e),0),n=N(t<0?r:r+1,t,r),t=n===null||n>r?t<0?0:r:n;while(e!==null&&e<t)i.push(this[e++]);return A(i)},filter:function(e){return A(C(this,k(e)))},not:function(e){return A(C(this,L(k(e))))},has:function(e){return A(C(this,p(e)?function(t){return E(e,t)}:typeof e=="string"&&e.length?function(t){return y(e,t).length}:a))},is:function(e){var t=0,n=this.length,r=k(e);for(;t<n;t++)if(r(this[t],t))return!0;return!1},toArray:function(){return s.slice.call(this)},size:function(){return this.length},each:function(e,t){var n=0,r=this.length;for(;n<r;n++)e.call(t||this[n],this[n],n,this);return this},push:s.push,sort:s.sort,splice:s.splice},r.prototype.prev=r.prototype.previous,i.aug=function(e){var t,n;for(t in e)n=e[t],typeof n=="function"&&(r.prototype[t]=n)},i.setSelectorEngine=function(e){var t,r,i,s,o,u=n.createElement("p"),a=e.select||e.sel||e;u.innerHTML="<a/><i/><b/>",i=u.firstChild;try{s=c(e.matching)?function(t,n){return e.matching([n],t).length>0}:c(e.is)?function(t,n){return e.is(n,t)}:c(e.matchesSelector)?function(t,n){return e.matchesSelector(n,t)}:c(e.match)?function(t,n){return e.match(n,t)}:null,s||(t=e("a",u),s=c(t._is)?function(t,n){return e(n)._is(t)}:c(t.matching)?function(t,n){return e(n).matching(t).length>0}:c(t.is)&&!t.is.__ignore?function(t,n){return e(n).is(t)}:c(t.matchesSelector)?function(t,n){return e(n).matchesSelector(t)}:c(t.match)?function(t,n){return e(n).match(t)}:null);if(!s)throw"Traversty: couldn't find selector engine's `matchesSelector`";if(s("x,y",u)||!s("a,p",u))throw"Traversty: couldn't make selector engine's `matchesSelector` work";if((r=a("b,a",u)).length!==2)throw"Traversty: don't know how to use this selector engine";o=r[0]===i?a:w(a,s);if((r=o("b,a",u)).length!==2||r[0]!==i)throw"Traversty: couldn't make selector engine work";b=s,y=o}catch(f){throw l(f)?f:"Traversty: error while figuring out how the selector engine works: "+(f.message||f)}finally{u=null}},i.noConflict=function(){return e.traversty=t,this},i}();return A});
*/!function(e,t){typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define(e,t):this[e]=t()}("traversty",function(){var e=this,t=e.traversty,n=window.document,r=n.documentElement,i=Object.prototype.toString,s=Array.prototype,o=s.slice,u=function(e,t,n,r,i){while(r<t.length)if(e[i=t[r++]+n])return i}(r,["msM","webkitM","mozM","oM","m"],"atchesSelector",0),a=function(){return!1},f=function(e){return i.call(e)==="[object Number]"},l=function(e){return i.call(e)==="[object String]"},c=function(e){return i.call(e)==="[object Function]"},h=function(e){return e===void 0},p=function(e){return e&&e.nodeType===1},d=function(e,t){return h(e)&&!f(t)?0:f(e)?e:f(t)?t:null},v=function(e){return l(e)?e:"*"},m=function(e,t){return o.call(t.querySelectorAll(e),0)},g=function(e,t){return e==="*"||t[u](e)},y=m,b=g,w=function(e,t){return function(n,r){if(/,/.test(n)){var i=[],s=-1,o=r.getElementsByTagName("*");while(++s<o.length)p(o[s])&&t(n,o[s])&&i.push(o[s]);return i}return e(n,r)}},E="compareDocumentPosition"in r?function(e,t){return(t.compareDocumentPosition(e)&16)==16}:"contains"in r?function(e,t){return t=t.nodeType===9||t==window?r:t,t!==e&&t.contains(e)}:function(e,t){while(e=e.parentNode)if(e===t)return 1;return 0},S=function(e){var t=[],n=-1,r,i;while(++n<e.length){r=-1,i=!1;while(++r<t.length)if(t[r]===e[n]){i=!0;break}i||t.push(e[n])}return t},x=function(e,t){var n=[],r,i=0,s,o=e.length,u;while(i<o){s=0,u=(r=t(e[i],i++)).length;while(s<u)n.push(r[s++])}return n},T=function(e,t,n,r,i){return r=d(n,r),n=v(n),x(e,function(e,s){var o=r||0,u=[];i||(e=e[t]);while(e&&(r===null||o>=0))p(e)&&(!i||i===!0||i(e,s))&&b(n,e)&&(r===null||o--===0)&&(r===null&&t!=="nextSibling"?u=[e].concat(u):u.push(e)),e=e[t];return u})},N=function(e,t,n){return t<0&&(t=e+t),t<0||t>=e?null:!t&&t!==0?n:t},C=function(e,t){var n=[],r=0,i=e.length;for(;r<i;r++)t(e[r],r)&&n.push(e[r]);return n},k=function(e){var t;return p(e)?function(t){return t===e}:(t=typeof e)=="function"?function(t,n){return e.call(t,n)}:t=="string"&&e.length?function(t){return b(e,t)}:a},L=function(e){return function(){return!e.apply(this,arguments)}},A=function(){function r(e){this.length=0;if(e){e=S(!e.nodeType&&!h(e.length)?e:[e]);var t=this.length=e.length;while(t--)this[t]=e[t]}}function i(e){return new r(l(e)?y(e,n):e)}return r.prototype={down:function(e,t){return t=d(e,t),e=v(e),A(x(this,function(n){var r=y(e,n);return t===null?r:[r[t]]||[]}))},up:function(e,t){return A(T(this,"parentNode",e,t))},parents:function(){return r.prototype.up.apply(this,arguments.length?arguments:["*"])},closest:function(e,t){if(f(e))t=e,e="*";else{if(!l(e))return A([]);f(t)||(t=0)}return A(T(this,"parentNode",e,t,!0))},previous:function(e,t){return A(T(this,"previousSibling",e,t))},next:function(e,t){return A(T(this,"nextSibling",e,t))},siblings:function(e,t){var n=this,r=o.call(this,0),i=0,s=r.length;for(;i<s;i++){r[i]=r[i].parentNode.firstChild;while(!p(r[i]))r[i]=r[i].nextSibling}return h(e)&&(e="*"),A(T(r,"nextSibling",e||"*",t,function(e,t){return e!==n[t]}))},children:function(e,t){return A(T(r.prototype.down.call(this),"nextSibling",e||"*",t,!0))},first:function(){return r.prototype.eq.call(this,0)},last:function(){return r.prototype.eq.call(this,-1)},eq:function(e){return A(this.get(e))},get:function(e){return this[N(this.length,e,0)]},slice:function(e,t){var n=t,r=this.length,i=[];e=N(r,Math.max(-this.length,e),0),n=N(t<0?r:r+1,t,r),t=n===null||n>r?t<0?0:r:n;while(e!==null&&e<t)i.push(this[e++]);return A(i)},filter:function(e){return A(C(this,k(e)))},not:function(e){return A(C(this,L(k(e))))},has:function(e){return A(C(this,p(e)?function(t){return E(e,t)}:typeof e=="string"&&e.length?function(t){return y(e,t).length}:a))},is:function(e){var t=0,n=this.length,r=k(e);for(;t<n;t++)if(r(this[t],t))return!0;return!1},toArray:function(){return s.slice.call(this)},size:function(){return this.length},each:function(e,t){var n=0,r=this.length;for(;n<r;n++)e.call(t||this[n],this[n],n,this);return this},push:s.push,sort:s.sort,splice:s.splice},r.prototype.prev=r.prototype.previous,i.aug=function(e){var t,n;for(t in e)n=e[t],typeof n=="function"&&(r.prototype[t]=n)},i.setSelectorEngine=function(e){var t,r,i,s,o,u=n.createElement("p"),a=e.select||e.sel||e;u.innerHTML="<a/><i/><b/>",i=u.firstChild;try{s=c(e.matching)?function(t,n){return e.matching([n],t).length>0}:c(e.is)?function(t,n){return e.is(n,t)}:c(e.matchesSelector)?function(t,n){return e.matchesSelector(n,t)}:c(e.match)?function(t,n){return e.match(n,t)}:c(e.matches)?function(t,n){return e.matches(n,t)}:null,s||(t=e("a",u),s=c(t._is)?function(t,n){return e(n)._is(t)}:c(t.matching)?function(t,n){return e(n).matching(t).length>0}:c(t.is)&&!t.is.__ignore?function(t,n){return e(n).is(t)}:c(t.matchesSelector)?function(t,n){return e(n).matchesSelector(t)}:c(t.match)?function(t,n){return e(n).match(t)}:c(t.matches)?function(t,n){return e(n).matches(t)}:null);if(!s)throw"Traversty: couldn't find selector engine's `matchesSelector`";if(s("x,y",u)||!s("a,p",u))throw"Traversty: couldn't make selector engine's `matchesSelector` work";if((r=a("b,a",u)).length!==2)throw"Traversty: don't know how to use this selector engine";o=r[0]===i?a:w(a,s);if((r=o("b,a",u)).length!==2||r[0]!==i)throw"Traversty: couldn't make selector engine work";b=s,y=o}catch(f){throw l(f)?f:"Traversty: error while figuring out how the selector engine works: "+(f.message||f)}finally{u=null}},i.noConflict=function(){return e.traversty=t,this},i}();return A});
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2012
* MIT License
*/
!function () {
var q, pseudos, i, l, p, r, nodes, m, nthPattern = /\s*((?:\+|\-)?(\d*))n\s*((?:\+|\-)\s*\d+)?\s*/
if (typeof module != 'undefined' && typeof 'require' != 'undefined')
q = require('qwery')
else if (typeof qwery != 'undefined')
q = qwery
else
return
pseudos = q.pseudos
function children(node, ofType) {
var r = []
nodes = node.childNodes
for (i = 0, l = nodes.length; i < l; i++) {
if (nodes[i].nodeType == 1 && (!ofType || nodes[i].nodeName == ofType)) r.push(nodes[i])
}
return r
}
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
return false
}
function checkNth(el, nodes, val) {
if (isFinite(val)) return nodes[val - 1] == el
else if (val == 'odd') return checkNthExpr(el, nodes, 2, 1)
else if (val == 'even') return checkNthExpr(el, nodes, 2, 0)
else if (m = nthPattern.exec(val))
return checkNthExpr(el, nodes,
(m[2] ? parseInt(m[1], 10) : parseInt(m[1] + '1', 10)), // Check case where coefficient is omitted
(m[3] ? parseInt(m[3].replace(/\s*/, ''), 10) : 0)) // Check case where constant is omitted
return false
}
function text(el, s) {
if (el.nodeType === 3 || el.nodeType === 4) return el.nodeValue;
if (el.nodeType !== 1 && el.nodeType !== 9) return '';
for (s = '', el = el.firstChild; el; el = el.nextSibling) {
if (el.nodeType !== 8) s += el.textContent || el.innerText || text(el)
}
return s
}
// *was* going to be in CSS3, didn't quite make it
pseudos.contains = function(el, val) { return text(el).indexOf(val) != -1 }
pseudos.not = function(el, val) { return !q.is(el, val) }
pseudos['nth-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p), val)
}
pseudos['nth-last-child'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p).reverse(), val)
}
pseudos['nth-of-type'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p, el.nodeName), val)
}
pseudos['nth-last-of-type'] = function (el, val) {
if (!val || !(p = el.parentNode)) return false
return checkNth(el, children(p, el.nodeName).reverse(), val)
}
pseudos['first-child'] = function (el) { return pseudos['nth-child'](el, 1) }
pseudos['last-child'] = function (el) { return pseudos['nth-last-child'](el, 1) }
pseudos['first-of-type'] = function (el) { return pseudos['nth-of-type'](el, 1) }
pseudos['last-of-type'] = function (el) { return pseudos['nth-last-of-type'](el, 1) }
pseudos['only-child'] = function (el) {
return (p = el.parentNode) && (nodes = children(p)) && (nodes.length == 1) && (el == nodes[0])
};
pseudos['only-of-type'] = function (el) {
return (p = el.parentNode) && (nodes = children(p, el.nodeName)) && (nodes.length == 1) && (el == nodes[0])
}
pseudos.target = function (el) {
return (el.getAttribute('id') == location.hash.substr(1))
}
pseudos.checked = function (el) { return el.checked }
pseudos.enabled = function (el) { return !el.disabled }
pseudos.disabled = function (el) { return el.disabled }
pseudos.empty = function (el) { return !el.childNodes.length }
}();
/*!
* @preserve Qwery - A Blazing Fast query selector engine
* https://github.com/ded/qwery
* copyright Dustin Diaz & Jacob Thornton 2012
* MIT License
*/
(function (name, definition, context) {
if (typeof module != 'undefined' && module.exports) module.exports = definition()
else if (typeof context['define'] == 'function' && context['define']['amd']) define(name, definition)
else context[name] = definition()
})('qwery', function () {
var doc = document
, html = doc.documentElement
, byClass = 'getElementsByClassName'
, byTag = 'getElementsByTagName'
, qSA = 'querySelectorAll'
, useNativeQSA = 'useNativeQSA'
, tagName = 'tagName'
, nodeType = 'nodeType'
, select // main select() method, assign later
, id = /#([\w\-]+)/
, clas = /\.[\w\-]+/g
, idOnly = /^#([\w\-]+)$/
, classOnly = /^\.([\w\-]+)$/
, tagOnly = /^([\w\-]+)$/
, tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/
, splittable = /(^|,)\s*[>~+]/
, normalizr = /^\s+|\s*([,\s\+\~>]|$)\s*/g
, splitters = /[\s\>\+\~]/
, splittersMore = /(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\]|[\s\w\+\-]*\))/
, specialChars = /([.*+?\^=!:${}()|\[\]\/\\])/g
, simple = /^(\*|[a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/
, attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/
, pseudo = /:([\w\-]+)(\(['"]?([^()]+)['"]?\))?/
, easy = new RegExp(idOnly.source + '|' + tagOnly.source + '|' + classOnly.source)
, 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
}
}
function cache() {
this.c = {}
}
cache.prototype = {
g: function (k) {
return this.c[k] || undefined
}
, s: function (k, v, r) {
v = r ? new RegExp(v) : v
return (this.c[k] = v)
}
}
var classCache = new cache()
, cleanCache = new cache()
, attrCache = new cache()
, tokenCache = new cache()
function classRegex(c) {
return classCache.g(c) || classCache.s(c, '(^|\\s+)' + c + '(\\s+|$)', 1)
}
// 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(a[i])
}
function flatten(ar) {
for (var r = [], i = 0, l = ar.length; i < l; ++i) arrayLike(ar[i]) ? (r = r.concat(ar[i])) : (r[r.length] = ar[i])
return r
}
function arrayify(ar) {
var i = 0, l = ar.length, r = []
for (; i < l; i++) r[i] = ar[i]
return r
}
function previous(n) {
while (n = n.previousSibling) if (n[nodeType] == 1) break;
return n
}
function q(query) {
return query.match(chunker)
}
// called using `this` as element and arguments from regex group results.
// given => div.hello[title="world"]:foo('bar')
// 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 (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
if (wholeAttribute && !value) { // select is just for existance of attrib
o = this.attributes
for (k in o) {
if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) {
return this
}
}
}
if (wholeAttribute && !checkAttr(qualifier, getAttr(this, attribute) || '', value)) {
// select is for attrib equality
return false
}
return this
}
function clean(s) {
return cleanCache.g(s) || cleanCache.s(s, s.replace(specialChars, '\\$1'))
}
function checkAttr(qualify, actual, val) {
switch (qualify) {
case '=':
return actual == val
case '^=':
return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, '^' + clean(val), 1))
case '$=':
return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, clean(val) + '$', 1))
case '*=':
return actual.match(attrCache.g(val) || attrCache.s(val, clean(val), 1))
case '~=':
return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, '(?:^|\\s+)' + clean(val) + '(?:\\s+|$)', 1))
case '|=':
return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, '^' + clean(val) + '(-|$)', 1))
}
return 0
}
// given a selector, first check for simple cases then collect all base candidate matches and filter
function _qwery(selector, _root) {
var r = [], ret = [], i, l, m, token, tag, els, intr, item, root = _root
, tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr))
, dividedTokens = selector.match(dividers)
if (!tokens.length) return r
token = (tokens = tokens.slice(0)).pop() // copy cached tokens, take the last one
if (tokens.length && (m = tokens[tokens.length - 1].match(idOnly))) root = byId(_root, m[1])
if (!root) return r
intr = q(token)
// collect base candidates to filter
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)
}
return r
}([]) :
root[byTag](intr[1] || '*')
// filter elements according to the right-most part of the selector
for (i = 0, l = els.length; i < l; i++) {
if (item = interpret.apply(els[i], intr)) r[r.length] = item
}
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 })
return ret
}
// compare element to a selector
function is(el, selector, root) {
if (isNode(selector)) return el == selector
if (arrayLike(selector)) return !!~flatten(selector).indexOf(el) // if selector is an array, is el a member?
var selectors = selector.split(','), tokens, dividedTokens
while (selector = selectors.pop()) {
tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr))
dividedTokens = selector.match(dividers)
tokens = tokens.slice(0) // copy array
if (interpret.apply(el, q(tokens.pop())) && (!tokens.length || ancestorMatch(el, tokens, dividedTokens, root))) {
return true
}
}
return false
}
// given elements matching the right-most part of a selector, filter out any that don't match the rest
function ancestorMatch(el, tokens, dividedTokens, root) {
var cand
// recursively work backwards through the tokens and up the dom, covering all options
function crawl(e, i, p) {
while (p = walker[dividedTokens[i]](p, e)) {
if (isNode(p) && (interpret.apply(p, q(tokens[i])))) {
if (i) {
if (cand = crawl(p, i - 1, p)) return cand
} else return p
}
}
}
return (cand = crawl(el, tokens.length - 1, el)) && (!root || isAncestor(cand, root))
}
function isNode(el, t) {
return el && typeof el === 'object' && (t = el[nodeType]) && (t == 1 || t == 9)
}
function uniq(ar) {
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]
}
return a
}
function arrayLike(o) {
return (typeof o === 'object' && isFinite(o.length))
}
function normalizeRoot(root) {
if (!root) return doc
if (typeof root == 'string') return qwery(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) :
root.ownerDocument &&
(((el = root.ownerDocument.getElementById(id)) && isAncestor(el, root) && el) ||
(!isAncestor(root, root.ownerDocument) && select('[id="' + id + '"]', root)[0]))
}
function qwery(selector, _root) {
var m, el, root = normalizeRoot(_root)
// easy, fast cases that we can dispatch with simple DOM calls
if (!root || !selector) return []
if (selector === window || isNode(selector)) {
return !_root || (selector !== window && isNode(root) && isAncestor(selector, root)) ? [selector] : []
}
if (selector && arrayLike(selector)) return flatten(selector)
if (m = selector.match(easy)) {
if (m[1]) return (el = byId(root, m[1])) ? [el] : []
if (m[2]) return arrayify(root[byTag](m[2]))
if (hasByClass && m[3]) return arrayify(root[byClass](m[3]))
}
return select(selector, root)
}
// 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) {
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')
}
return;
}
s.length && collector(root, s, false)
}
}
var isAncestor = 'compareDocumentPosition' in html ?
function (element, container) {
return (container.compareDocumentPosition(element) & 16) == 16
} : 'contains' in html ?
function (element, container) {
container = container[nodeType] === 9 || container == window ? html : container
return container !== element && container.contains(element)
} :
function (element, container) {
while (element = element.parentNode) if (element === container) return 1
return 0
}
, 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) {
return a === 'class' ? e.className : (a === 'href' || a === 'src') ?
e.getAttribute(a, 2) : e.getAttribute(a)
} :
function(e, a) { return e.getAttribute(a) }
}()
, hasByClass = !!doc[byClass]
// has native qSA support
, hasQSA = doc.querySelector && doc[qSA]
// use native qSA
, selectQSA = function (selector, root) {
var result = [], ss, e
try {
if (root[nodeType] === 9 || !splittable.test(selector)) {
// most work is done right here, defer to qSA
return arrayify(root[qSA](selector))
}
// special case where we need the services of `collectSelector()`
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) { }
return selectNonNative(selector, root)
}
// no native selector support
, selectNonNative = function (selector, root) {
var result = [], items, m, i, l, r, ss
selector = selector.replace(normalizr, '$1')
if (m = selector.match(tagAndOrClass)) {
r = classRegex(m[2])
items = root[byTag](m[1] || '*')
for (i = 0, l = items.length; i < l; i++) {
if (r.test(items[i].className)) result[result.length] = items[i]
}
return result
}
// more complex selector, get `_qwery()` to do the work for us
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]
}
}))
return ss.length > 1 && result.length > 1 ? uniq(result) : result
}
, configure = function (options) {
// configNativeQSA: use fully-internal selector or native qSA where present
if (typeof options[useNativeQSA] !== 'undefined')
select = !options[useNativeQSA] ? selectNonNative : hasQSA ? selectQSA : selectNonNative
}
configure({ useNativeQSA: true })
qwery.configure = configure
qwery.uniq = uniq
qwery.is = is
qwery.pseudos = {}
return qwery
}, this);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display