[Pkg-javascript-commits] [node-css-select] 01/04: New upstream version 1.3.0~rc0

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Mon Jan 15 18:23:08 UTC 2018


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-css-select.

commit 4edd5970e48ae17323d99f6bd9932893bc249845
Author: Pirate Praveen <praveen at debian.org>
Date:   Mon Jan 15 23:41:20 2018 +0530

    New upstream version 1.3.0~rc0
---
 .eslintrc                    |   95 ++++
 .travis.yml                  |    5 +-
 README.md                    |   74 +++
 browser_functions.js         |   67 ---
 index.js                     |   74 ++-
 lib/attributes.js            |  326 ++++++-------
 lib/compile.js               |  315 +++++++------
 lib/general.js               |  172 +++----
 lib/pseudos.js               |  651 +++++++++++++-------------
 package.json                 |   39 +-
 test/api.js                  |   38 +-
 test/attributes.js           |    6 +-
 test/icontains.js            |   30 +-
 test/nwmatcher/index.js      |  374 ++++++++-------
 test/qwery/index.js          |  808 ++++++++++++++++----------------
 test/sizzle/data/testinit.js |   45 +-
 test/sizzle/selector.js      | 1040 +++++++++++++++++++++---------------------
 test/test.js                 |    4 +-
 test/tools/bench.js          |    2 +-
 test/tools/helper.js         |   14 +-
 test/tools/slickspeed.js     |   24 +-
 21 files changed, 2183 insertions(+), 2020 deletions(-)

diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..b77ef68
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,95 @@
+{
+  "extends": "eslint:recommended",
+  "env": {
+    "node": true
+  },
+  "globals": {
+    "beforeEach": true,
+    "describe": true,
+    "it": true
+  },
+  "rules": {
+  	"no-console": 0,
+  	"new-cap": 0,
+  	"space-before-blocks": [2, "never"],
+  	"space-in-parens": [2, "never"],
+    "eqeqeq": [2, "allow-null"],
+    "no-extend-native": 2,
+    "no-use-before-define": [
+      2,
+      {
+        "functions": false,
+        "classes": false
+      }
+    ],
+    "no-caller": 2,
+    "no-irregular-whitespace": 2,
+    "quotes": [
+      2,
+      "double"
+    ],
+    "no-undef": 2,
+    "no-unused-vars": 2,
+    "no-proto": 2,
+    "curly": [
+      2,
+      "multi-line"
+    ],
+    "no-mixed-spaces-and-tabs": [
+      2,
+      "smart-tabs"
+    ],
+    "space-infix-ops": 2,
+    "keyword-spacing": [
+      2,
+      {
+        "overrides": {
+          "if": {
+            "after": false
+          },
+          "catch": {
+            "after": false
+          },
+          "for": {
+            "after": false
+          },
+          "while": {
+            "after": false
+          }
+        }
+      }
+    ],
+    "comma-style": [
+      2,
+      "last"
+    ],
+    "dot-notation": 2,
+    "wrap-iife": 2,
+    "no-empty": 2,
+    "space-unary-ops": [
+      2,
+      {
+        "words": false,
+        "nonwords": false
+      }
+    ],
+    "no-with": 2,
+    "no-multi-str": 2,
+    "no-trailing-spaces": 2,
+    "indent": [
+      2,
+      "tab",
+      {
+        "SwitchCase": 1
+      }
+    ],
+    "linebreak-style": [
+      2,
+      "unix"
+    ],
+    "consistent-this": [
+      2,
+      "_this"
+    ]
+  }
+}
diff --git a/.travis.yml b/.travis.yml
index 577ee23..0bc3fb1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,7 @@
 language: node_js
 node_js:
-  - "0.10"
-  - 0.11
+  - stable
+  - 6
+  - 4
 
 script: npm run coveralls
diff --git a/README.md b/README.md
index e36282f..b03c64a 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ a CSS selector compiler/engine
 css-select turns CSS selectors into functions that tests if elements match them. When searching for elements, testing is executed "from the top", similar to how browsers execute CSS selectors.
 
 In its default configuration, css-select queries the DOM structure of the [`domhandler`](https://github.com/fb55/domhandler) module (also known as htmlparser2 DOM).
+It uses [`domutils`](https://github.com/fb55/domutils) as its default adapter over the DOM structure. See Options below for details on querying alternative DOM structures.
 
 __Features:__
 
@@ -86,6 +87,79 @@ Arguments are the same as for `CSSselect(query, elems)`. Only returns the first
 - `xmlMode`: When enabled, tag names will be case-sensitive. Default: `false`.
 - `strict`: Limits the module to only use CSS3 selectors. Default: `false`.
 - `rootFunc`: The last function in the stack, will be called with the last element that's looked at. Should return `true`.
+- `adapter`: The adapter to use when interacting with the backing DOM structure. By default it uses [`domutils`](https://github.com/fb55/domutils).
+
+#### Custom Adapters
+
+A custom adapter must implement the following functions:
+
+```
+isTag, existsOne, getAttributeValue, getChildren, getName, getParent,
+getSiblings, getText, hasAttrib, removeSubsets, findAll, findOne
+```
+
+The method signature notation used below should be fairly intuitive - if not,
+see the [`rtype`](https://github.com/ericelliott/rtype) or
+[`TypeScript`](https://www.typescriptlang.org/) docs, as it is very similar to
+both of those. You may also want to look at
+-[`domutils`](https://github.com/fb55/domutils) to see the default 
+-implementation, or at 
+-[`css-select-browser-adapter`](https://github.com/nrkn/css-select-browser-adapter/blob/master/index.js) 
+-for an implementation backed by the DOM.
+
+```ts
+{
+  // is the node a tag?
+  isTag: ( node:Node ) => isTag:Boolean,
+
+  // does at least one of passed element nodes pass the test predicate?
+  existsOne: ( test:Predicate, elems:[ElementNode] ) => existsOne:Boolean,
+
+  // get the attribute value
+  getAttributeValue: ( elem:ElementNode, name:String ) => value:String,
+
+  // get the node's children
+  getChildren: ( node:Node ) => children:[Node],
+
+  // get the name of the tag
+  getName: ( elem:ElementNode ) => tagName:String,
+
+  // get the parent of the node
+  getParent: ( node:Node ) => parentNode:Node,
+
+  /*
+    get the siblings of the node. Note that unlike jQuery's `siblings` method,
+    this is expected to include the current node as well
+  */
+  getSiblings: ( node:Node ) => siblings:[Node],
+
+  // get the text content of the node, and its children if it has any
+  getText: ( node:Node ) => text:String,
+
+  // does the element have the named attribute?
+  hasAttrib: ( elem:ElementNode, name:String ) => hasAttrib:Boolean,
+
+  // takes an array of nodes, and removes any duplicates, as well as any nodes
+  // whose ancestors are also in the array
+  removeSubsets: ( nodes:[Node] ) => unique:[Node],
+
+  // finds all of the element nodes in the array that match the test predicate,
+  // as well as any of their children that match it
+  findAll: ( test:Predicate, nodes:[Node] ) => elems:[ElementNode],
+
+  // finds the first node in the array that matches the test predicate, or one
+  // of its children 
+  findOne: ( test:Predicate, elems:[ElementNode] ) => findOne:ElementNode,
+
+  /*
+    The adapter can also optionally include an equals method, if your DOM
+    structure needs a custom equality test to compare two objects which refer
+    to the same underlying node. If not provided, `css-select` will fall back to
+    `a === b`.
+  */
+  equals: ( a:Node, b:Node ) => Boolean
+}
+```
 
 ## Supported selectors
 
diff --git a/browser_functions.js b/browser_functions.js
deleted file mode 100644
index 024540d..0000000
--- a/browser_functions.js
+++ /dev/null
@@ -1,67 +0,0 @@
-function isTag(elem){
-	return elem.nodeType === 1;
-}
-function getChildren(elem){
-	return Array.prototype.slice.call(elem.childNodes, 0);
-}
-function getParent(elem){
-	return elem.parentElement;
-}
-
-module.exports = {
-	isTag: isTag,
-	getSiblings: function(elem){
-		var parent = getParent(elem);
-		return parent && getChildren(parent);
-	},
-	getChildren: getChildren,
-	getParent: getParent,
-	getAttributeValue: function(elem, name){
-		return elem.attributes[name].value;
-	},
-	hasAttrib: function(elem, name){
-		return name in elem.attributes;
-	},
-	getName: function(elem){
-		return elem.tagName.toLowerCase();
-	},
-	findOne: function findOne(test, arr){
-		var elem = null;
-
-		for(var i = 0, l = arr.length; i < l && !elem; i++){
-			if(test(arr[i])){
-				elem = arr[i];
-			} else {
-				var childs = getChildren(arr[i]);
-				if(childs && childs.length > 0){
-					elem = findOne(test, childs);
-				}
-			}
-		}
-
-		return elem;
-	},
-	findAll: function findAll(test, elems){
-		var result = [];
-		for(var i = 0, j = elems.length; i < j; i++){
-			if(!isTag(elems[i])) continue;
-			if(test(elems[i])) result.push(elems[i]);
-			var childs = getChildren(elems[i]);
-			if(childs) result = result.concat(findAll(test, childs));
-		}
-		return result;
-	},
-	//https://github.com/ded/qwery/blob/master/pseudos/qwery-pseudos.js#L47-54
-	getText: function getText(elem) {
-		var str = "",
-		    childs = getChildren(elem);
-
-		if(!childs) return str;
-
-		for(var i = 0; i < childs.length; i++){
-			if(isTag(childs[i])) str += elem.textContent || elem.innerText || getText(childs[i]);
-		}
-
-		return str;
-	}
-};
diff --git a/index.js b/index.js
index 4179d19..8f2f38d 100644
--- a/index.js
+++ b/index.js
@@ -2,35 +2,61 @@
 
 module.exports = CSSselect;
 
-var Pseudos       = require("./lib/pseudos.js"),
-    DomUtils      = require("domutils"),
-    findOne       = DomUtils.findOne,
-    findAll       = DomUtils.findAll,
-    getChildren   = DomUtils.getChildren,
-    removeSubsets = DomUtils.removeSubsets,
-    falseFunc     = require("boolbase").falseFunc,
-    compile       = require("./lib/compile.js"),
-    compileUnsafe = compile.compileUnsafe,
-    compileToken  = compile.compileToken;
+var DomUtils       = require("domutils"),
+	falseFunc      = require("boolbase").falseFunc,
+	compileFactory = require("./lib/compile.js"),
+	defaultCompile = compileFactory(DomUtils);
+
+function adapterCompile(adapter){
+	return adapter === DomUtils ? defaultCompile : compileFactory(adapter);
+}
 
 function getSelectorFunc(searchFunc){
 	return function select(query, elems, options){
-        if(typeof query !== "function") query = compileUnsafe(query, options, elems);
-        if(!Array.isArray(elems)) elems = getChildren(elems);
-		else elems = removeSubsets(elems);
-		return searchFunc(query, elems);
+		options = options || {}
+		options.adapter = options.adapter || DomUtils;
+		var compile = adapterCompile(options.adapter);
+
+		if(typeof query !== "function") query = compile.compileUnsafe(query, options, elems);
+		if(query.shouldTestNextSiblings) elems = appendNextSiblings((options && options.context) || elems, options.adapter);
+		if(!Array.isArray(elems)) elems = options.adapter.getChildren(elems);
+		else elems = options.adapter.removeSubsets(elems);
+		return searchFunc(query, elems, options);
 	};
 }
 
-var selectAll = getSelectorFunc(function selectAll(query, elems){
-	return (query === falseFunc || !elems || elems.length === 0) ? [] : findAll(query, elems);
+function getNextSiblings(elem, adapter){
+	var siblings = adapter.getSiblings(elem);
+	if(!Array.isArray(siblings)) return [];
+	siblings = siblings.slice(0);
+	while(siblings.shift() !== elem);
+	return siblings;
+}
+
+function appendNextSiblings(elems, adapter){
+	// Order matters because jQuery seems to check the children before the siblings
+	if(!Array.isArray(elems)) elems = [elems];
+	var newElems = elems.slice(0);
+
+	for(var i = 0, len = elems.length; i < len; i++){
+		var nextSiblings = getNextSiblings(newElems[i], adapter);
+		newElems.push.apply(newElems, nextSiblings);
+	}
+	return newElems;
+}
+
+var selectAll = getSelectorFunc(function selectAll(query, elems, options){
+	return (query === falseFunc || !elems || elems.length === 0) ? [] : options.adapter.findAll(query, elems);
 });
 
-var selectOne = getSelectorFunc(function selectOne(query, elems){
-	return (query === falseFunc || !elems || elems.length === 0) ? null : findOne(query, elems);
+var selectOne = getSelectorFunc(function selectOne(query, elems, options){
+	return (query === falseFunc || !elems || elems.length === 0) ? null : options.adapter.findOne(query, elems);
 });
 
 function is(elem, query, options){
+	options = options || {}
+	options.adapter = options.adapter || DomUtils;
+	var compile = adapterCompile(options.adapter);
 	return (typeof query === "function" ? query : compile(query, options))(elem);
 }
 
@@ -41,9 +67,9 @@ function CSSselect(query, elems, options){
 	return selectAll(query, elems, options);
 }
 
-CSSselect.compile = compile;
-CSSselect.filters = Pseudos.filters;
-CSSselect.pseudos = Pseudos.pseudos;
+CSSselect.compile = defaultCompile;
+CSSselect.filters = defaultCompile.Pseudos.filters;
+CSSselect.pseudos = defaultCompile.Pseudos.pseudos;
 
 CSSselect.selectAll = selectAll;
 CSSselect.selectOne = selectOne;
@@ -51,9 +77,9 @@ CSSselect.selectOne = selectOne;
 CSSselect.is = is;
 
 //legacy methods (might be removed)
-CSSselect.parse = compile;
+CSSselect.parse = defaultCompile;
 CSSselect.iterate = selectAll;
 
 //hooks
-CSSselect._compileUnsafe = compileUnsafe;
-CSSselect._compileToken = compileToken;
+CSSselect._compileUnsafe = defaultCompile.compileUnsafe;
+CSSselect._compileToken = defaultCompile.compileToken;
diff --git a/lib/attributes.js b/lib/attributes.js
index a8689c0..7568219 100644
--- a/lib/attributes.js
+++ b/lib/attributes.js
@@ -1,181 +1,181 @@
-var DomUtils  = require("domutils"),
-    hasAttrib = DomUtils.hasAttrib,
-    getAttributeValue = DomUtils.getAttributeValue,
-    falseFunc = require("boolbase").falseFunc;
+var falseFunc = require("boolbase").falseFunc;
 
 //https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js#L469
 var reChars = /[-[\]{}()*+?.,\\^$|#\s]/g;
 
-/*
-	attribute selectors
-*/
-
-var attributeRules = {
-	__proto__: null,
-	equals: function(next, data){
-		var name  = data.name,
-		    value = data.value;
-
-		if(data.ignoreCase){
-			value = value.toLowerCase();
-
-			return function equalsIC(elem){
-				var attr = getAttributeValue(elem, name);
-				return attr != null && attr.toLowerCase() === value && next(elem);
+function factory(adapter){
+	/*
+		attribute selectors
+	*/
+	var attributeRules = {
+		__proto__: null,
+		equals: function(next, data){
+			var name  = data.name,
+				value = data.value;
+
+			if(data.ignoreCase){
+				value = value.toLowerCase();
+
+				return function equalsIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null && attr.toLowerCase() === value && next(elem);
+				};
+			}
+
+			return function equals(elem){
+				return adapter.getAttributeValue(elem, name) === value && next(elem);
 			};
-		}
-
-		return function equals(elem){
-			return getAttributeValue(elem, name) === value && next(elem);
-		};
-	},
-	hyphen: function(next, data){
-		var name  = data.name,
-		    value = data.value,
-		    len = value.length;
-
-		if(data.ignoreCase){
-			value = value.toLowerCase();
-
-			return function hyphenIC(elem){
-				var attr = getAttributeValue(elem, name);
+		},
+		hyphen: function(next, data){
+			var name  = data.name,
+				value = data.value,
+				len = value.length;
+
+			if(data.ignoreCase){
+				value = value.toLowerCase();
+
+				return function hyphenIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null &&
+							(attr.length === len || attr.charAt(len) === "-") &&
+							attr.substr(0, len).toLowerCase() === value &&
+							next(elem);
+				};
+			}
+
+			return function hyphen(elem){
+				var attr = adapter.getAttributeValue(elem, name);
 				return attr != null &&
+						attr.substr(0, len) === value &&
 						(attr.length === len || attr.charAt(len) === "-") &&
-						attr.substr(0, len).toLowerCase() === value &&
 						next(elem);
 			};
-		}
-
-		return function hyphen(elem){
-			var attr = getAttributeValue(elem, name);
-			return attr != null &&
-					attr.substr(0, len) === value &&
-					(attr.length === len || attr.charAt(len) === "-") &&
-					next(elem);
-		};
-	},
-	element: function(next, data){
-		var name = data.name,
-		    value = data.value;
-
-		if(/\s/.test(value)){
-			return falseFunc;
-		}
-
-		value = value.replace(reChars, "\\$&");
-
-		var pattern = "(?:^|\\s)" + value + "(?:$|\\s)",
-		    flags = data.ignoreCase ? "i" : "",
-		    regex = new RegExp(pattern, flags);
-
-		return function element(elem){
-			var attr = getAttributeValue(elem, name);
-			return attr != null && regex.test(attr) && next(elem);
-		};
-	},
-	exists: function(next, data){
-		var name = data.name;
-		return function exists(elem){
-			return hasAttrib(elem, name) && next(elem);
-		};
-	},
-	start: function(next, data){
-		var name  = data.name,
-		    value = data.value,
-		    len = value.length;
-
-		if(len === 0){
-			return falseFunc;
-		}
-		
-		if(data.ignoreCase){
-			value = value.toLowerCase();
-
-			return function startIC(elem){
-				var attr = getAttributeValue(elem, name);
-				return attr != null && attr.substr(0, len).toLowerCase() === value && next(elem);
-			};
-		}
-
-		return function start(elem){
-			var attr = getAttributeValue(elem, name);
-			return attr != null && attr.substr(0, len) === value && next(elem);
-		};
-	},
-	end: function(next, data){
-		var name  = data.name,
-		    value = data.value,
-		    len   = -value.length;
-
-		if(len === 0){
-			return falseFunc;
-		}
+		},
+		element: function(next, data){
+			var name = data.name,
+				value = data.value;
 
-		if(data.ignoreCase){
-			value = value.toLowerCase();
+			if(/\s/.test(value)){
+				return falseFunc;
+			}
 
-			return function endIC(elem){
-				var attr = getAttributeValue(elem, name);
-				return attr != null && attr.substr(len).toLowerCase() === value && next(elem);
-			};
-		}
-
-		return function end(elem){
-			var attr = getAttributeValue(elem, name);
-			return attr != null && attr.substr(len) === value && next(elem);
-		};
-	},
-	any: function(next, data){
-		var name  = data.name,
-		    value = data.value;
-
-		if(value === ""){
-			return falseFunc;
-		}
+			value = value.replace(reChars, "\\$&");
 
-		if(data.ignoreCase){
-			var regex = new RegExp(value.replace(reChars, "\\$&"), "i");
+			var pattern = "(?:^|\\s)" + value + "(?:$|\\s)",
+				flags = data.ignoreCase ? "i" : "",
+				regex = new RegExp(pattern, flags);
 
-			return function anyIC(elem){
-				var attr = getAttributeValue(elem, name);
+			return function element(elem){
+				var attr = adapter.getAttributeValue(elem, name);
 				return attr != null && regex.test(attr) && next(elem);
 			};
-		}
-
-		return function any(elem){
-			var attr = getAttributeValue(elem, name);
-			return attr != null && attr.indexOf(value) >= 0 && next(elem);
-		};
-	},
-	not: function(next, data){
-		var name  = data.name,
-		    value = data.value;
-
-		if(value === ""){
-			return function notEmpty(elem){
-				return !!getAttributeValue(elem, name) && next(elem);
+		},
+		exists: function(next, data){
+			var name = data.name;
+			return function exists(elem){
+				return adapter.hasAttrib(elem, name) && next(elem);
 			};
-		} else if(data.ignoreCase){
-			value = value.toLowerCase();
-
-			return function notIC(elem){
-				var attr = getAttributeValue(elem, name);
-				return attr != null && attr.toLowerCase() !== value && next(elem);
+		},
+		start: function(next, data){
+			var name  = data.name,
+				value = data.value,
+				len = value.length;
+
+			if(len === 0){
+				return falseFunc;
+			}
+
+			if(data.ignoreCase){
+				value = value.toLowerCase();
+
+				return function startIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null && attr.substr(0, len).toLowerCase() === value && next(elem);
+				};
+			}
+
+			return function start(elem){
+				var attr = adapter.getAttributeValue(elem, name);
+				return attr != null && attr.substr(0, len) === value && next(elem);
+			};
+		},
+		end: function(next, data){
+			var name  = data.name,
+				value = data.value,
+				len   = -value.length;
+
+			if(len === 0){
+				return falseFunc;
+			}
+
+			if(data.ignoreCase){
+				value = value.toLowerCase();
+
+				return function endIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null && attr.substr(len).toLowerCase() === value && next(elem);
+				};
+			}
+
+			return function end(elem){
+				var attr = adapter.getAttributeValue(elem, name);
+				return attr != null && attr.substr(len) === value && next(elem);
+			};
+		},
+		any: function(next, data){
+			var name  = data.name,
+				value = data.value;
+
+			if(value === ""){
+				return falseFunc;
+			}
+
+			if(data.ignoreCase){
+				var regex = new RegExp(value.replace(reChars, "\\$&"), "i");
+
+				return function anyIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null && regex.test(attr) && next(elem);
+				};
+			}
+
+			return function any(elem){
+				var attr = adapter.getAttributeValue(elem, name);
+				return attr != null && attr.indexOf(value) >= 0 && next(elem);
+			};
+		},
+		not: function(next, data){
+			var name  = data.name,
+				value = data.value;
+
+			if(value === ""){
+				return function notEmpty(elem){
+					return !!adapter.getAttributeValue(elem, name) && next(elem);
+				};
+			} else if(data.ignoreCase){
+				value = value.toLowerCase();
+
+				return function notIC(elem){
+					var attr = adapter.getAttributeValue(elem, name);
+					return attr != null && attr.toLowerCase() !== value && next(elem);
+				};
+			}
+
+			return function not(elem){
+				return adapter.getAttributeValue(elem, name) !== value && next(elem);
 			};
 		}
-
-		return function not(elem){
-			return getAttributeValue(elem, name) !== value && next(elem);
-		};
-	}
-};
-
-module.exports = {
-	compile: function(next, data, options){
-		if(options && options.strict && (
-			data.ignoreCase || data.action === "not"
-		)) throw SyntaxError("Unsupported attribute selector");
-		return attributeRules[data.action](next, data);
-	},
-	rules: attributeRules
-};
+	};
+
+	return {
+		compile: function(next, data, options){
+			if(options && options.strict && (
+				data.ignoreCase || data.action === "not"
+			)) throw new Error("Unsupported attribute selector");
+			return attributeRules[data.action](next, data);
+		},
+		rules: attributeRules
+	};
+}
+
+module.exports = factory;
diff --git a/lib/compile.js b/lib/compile.js
index 91ac592..e6b983b 100644
--- a/lib/compile.js
+++ b/lib/compile.js
@@ -2,191 +2,206 @@
 	compiles a selector to an executable function
 */
 
-module.exports = compile;
-module.exports.compileUnsafe = compileUnsafe;
-module.exports.compileToken = compileToken;
-
-var parse       = require("css-what"),
-    DomUtils    = require("domutils"),
-    isTag       = DomUtils.isTag,
-    Rules       = require("./general.js"),
-    sortRules   = require("./sort.js"),
-    BaseFuncs   = require("boolbase"),
-    trueFunc    = BaseFuncs.trueFunc,
-    falseFunc   = BaseFuncs.falseFunc,
-    procedure   = require("./procedure.json");
-
-function compile(selector, options, context){
-	var next = compileUnsafe(selector, options, context);
-	return wrap(next);
-}
+module.exports = compileFactory;
+
+var parse          = require("css-what"),
+	BaseFuncs      = require("boolbase"),
+	sortRules      = require("./sort.js"),
+	procedure      = require("./procedure.json"),
+	rulesFactory   = require("./general.js"),
+	pseudosFactory = require("./pseudos.js"),
+	trueFunc       = BaseFuncs.trueFunc,
+	falseFunc      = BaseFuncs.falseFunc;
+
+function compileFactory(adapter){
+	var Pseudos     = pseudosFactory(adapter),
+		filters     = Pseudos.filters,
+		Rules 			= rulesFactory(adapter, Pseudos);
+
+	function compile(selector, options, context){
+		var next = compileUnsafe(selector, options, context);
+		return wrap(next);
+	}
 
-function wrap(next){
-	return function base(elem){
-		return isTag(elem) && next(elem);
-	};
-}
+	function wrap(next){
+		return function base(elem){
+			return adapter.isTag(elem) && next(elem);
+		};
+	}
 
-function compileUnsafe(selector, options, context){
-	var token = parse(selector, options);
-	return compileToken(token, options, context);
-}
+	function compileUnsafe(selector, options, context){
+		var token = parse(selector, options);
+		return compileToken(token, options, context);
+	}
 
-function includesScopePseudo(t){
-    return t.type === "pseudo" && (
-        t.name === "scope" || (
-            Array.isArray(t.data) &&
-            t.data.some(function(data){
-                return data.some(includesScopePseudo);
-            })
-        )
-    );
-}
+	function includesScopePseudo(t){
+		return t.type === "pseudo" && (
+			t.name === "scope" || (
+				Array.isArray(t.data) &&
+				t.data.some(function(data){
+					return data.some(includesScopePseudo);
+				})
+			)
+		);
+	}
 
-var DESCENDANT_TOKEN = {type: "descendant"},
-    SCOPE_TOKEN = {type: "pseudo", name: "scope"},
-    PLACEHOLDER_ELEMENT = {},
-    getParent = DomUtils.getParent;
-
-//CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector
-//http://www.w3.org/TR/selectors4/#absolutizing
-function absolutize(token, context){
-    //TODO better check if context is document
-    var hasContext = !!context && !!context.length && context.every(function(e){
-        return e === PLACEHOLDER_ELEMENT || !!getParent(e);
-    });
-
-
-    token.forEach(function(t){
-        if(t.length > 0 && isTraversal(t[0]) && t[0].type !== "descendant"){
-            //don't return in else branch
-        } else if(hasContext && !includesScopePseudo(t)){
-            t.unshift(DESCENDANT_TOKEN);
-        } else {
-            return;
-        }
-
-        t.unshift(SCOPE_TOKEN);
-    });
-}
+	var DESCENDANT_TOKEN = {type: "descendant"},
+		FLEXIBLE_DESCENDANT_TOKEN = {type: "_flexibleDescendant"},
+		SCOPE_TOKEN = {type: "pseudo", name: "scope"},
+		PLACEHOLDER_ELEMENT = {};
+
+	//CSS 4 Spec (Draft): 3.3.1. Absolutizing a Scope-relative Selector
+	//http://www.w3.org/TR/selectors4/#absolutizing
+	function absolutize(token, context){
+		//TODO better check if context is document
+		var hasContext = !!context && !!context.length && context.every(function(e){
+			return e === PLACEHOLDER_ELEMENT || !!adapter.getParent(e);
+		});
+
+
+		token.forEach(function(t){
+			if(t.length > 0 && isTraversal(t[0]) && t[0].type !== "descendant"){
+				//don't return in else branch
+			} else if(hasContext && !includesScopePseudo(t)){
+				t.unshift(DESCENDANT_TOKEN);
+			} else {
+				return;
+			}
+
+			t.unshift(SCOPE_TOKEN);
+		});
+	}
 
-function compileToken(token, options, context){
-    token = token.filter(function(t){ return t.length > 0; });
+	function compileToken(token, options, context){
+		token = token.filter(function(t){ return t.length > 0; });
 
-	token.forEach(sortRules);
+		token.forEach(sortRules);
 
-	var isArrayContext = Array.isArray(context);
+		var isArrayContext = Array.isArray(context);
 
-    context = (options && options.context) || context;
+		context = (options && options.context) || context;
 
-    if(context && !isArrayContext) context = [context];
+		if(context && !isArrayContext) context = [context];
 
-    absolutize(token, context);
+		absolutize(token, context);
 
-	return token
-		.map(function(rules){ return compileRules(rules, options, context, isArrayContext); })
-		.reduce(reduceRules, falseFunc);
-}
+		var shouldTestNextSiblings = false;
 
-function isTraversal(t){
-	return procedure[t.type] < 0;
-}
+		var query = token
+			.map(function(rules){
+				if(rules[0] && rules[1] && rules[0].name === "scope"){
+					var ruleType = rules[1].type;
+					if(isArrayContext && ruleType === "descendant") rules[1] = FLEXIBLE_DESCENDANT_TOKEN;
+					else if(ruleType === "adjacent" || ruleType === "sibling") shouldTestNextSiblings = true;
+				}
+				return compileRules(rules, options, context);
+			})
+			.reduce(reduceRules, falseFunc);
 
-function compileRules(rules, options, context, isArrayContext){
-	var acceptSelf = (isArrayContext && rules[0].name === "scope" && rules[1].type === "descendant");
-	return rules.reduce(function(func, rule, index){
-		if(func === falseFunc) return func;
-		return Rules[rule.type](func, rule, options, context, acceptSelf && index === 1);
-	}, options && options.rootFunc || trueFunc);
-}
+		query.shouldTestNextSiblings = shouldTestNextSiblings;
 
-function reduceRules(a, b){
-	if(b === falseFunc || a === trueFunc){
-		return a;
-	}
-	if(a === falseFunc || b === trueFunc){
-		return b;
+		return query;
 	}
 
-	return function combine(elem){
-		return a(elem) || b(elem);
-	};
-}
+	function isTraversal(t){
+		return procedure[t.type] < 0;
+	}
 
-//:not, :has and :matches have to compile selectors
-//doing this in lib/pseudos.js would lead to circular dependencies,
-//so we add them here
+	function compileRules(rules, options, context){
+		return rules.reduce(function(func, rule){
+			if(func === falseFunc) return func;
+			return Rules[rule.type](func, rule, options, context);
+		}, options && options.rootFunc || trueFunc);
+	}
 
-var Pseudos     = require("./pseudos.js"),
-    filters     = Pseudos.filters,
-    existsOne   = DomUtils.existsOne,
-    isTag       = DomUtils.isTag,
-    getChildren = DomUtils.getChildren;
+	function reduceRules(a, b){
+		if(b === falseFunc || a === trueFunc){
+			return a;
+		}
+		if(a === falseFunc || b === trueFunc){
+			return b;
+		}
 
+		return function combine(elem){
+			return a(elem) || b(elem);
+		};
+	}
 
-function containsTraversal(t){
-	return t.some(isTraversal);
-}
+	function containsTraversal(t){
+		return t.some(isTraversal);
+	}
 
-filters.not = function(next, token, options, context){
-	var opts = {
-	    	xmlMode: !!(options && options.xmlMode),
-	    	strict: !!(options && options.strict)
-	    };
+	//:not, :has and :matches have to compile selectors
+	//doing this in lib/pseudos.js would lead to circular dependencies,
+	//so we add them here
+	filters.not = function(next, token, options, context){
+		var opts = {
+			xmlMode: !!(options && options.xmlMode),
+			strict: !!(options && options.strict)
+		};
 
-	if(opts.strict){
-		if(token.length > 1 || token.some(containsTraversal)){
-			throw new SyntaxError("complex selectors in :not aren't allowed in strict mode");
+		if(opts.strict){
+			if(token.length > 1 || token.some(containsTraversal)){
+				throw new Error("complex selectors in :not aren't allowed in strict mode");
+			}
 		}
-	}
 
-    var func = compileToken(token, opts, context);
+		var func = compileToken(token, opts, context);
 
-	if(func === falseFunc) return next;
-	if(func === trueFunc)  return falseFunc;
+		if(func === falseFunc) return next;
+		if(func === trueFunc)  return falseFunc;
 
-	return function(elem){
-		return !func(elem) && next(elem);
+		return function(elem){
+			return !func(elem) && next(elem);
+		};
 	};
-};
 
-filters.has = function(next, token, options){
-	var opts = {
-		xmlMode: !!(options && options.xmlMode),
-		strict: !!(options && options.strict)
-	};
+	filters.has = function(next, token, options){
+		var opts = {
+			xmlMode: !!(options && options.xmlMode),
+			strict: !!(options && options.strict)
+		};
 
-    //FIXME: Uses an array as a pointer to the current element (side effects)
-    var context = token.some(containsTraversal) ? [PLACEHOLDER_ELEMENT] : null;
+		//FIXME: Uses an array as a pointer to the current element (side effects)
+		var context = token.some(containsTraversal) ? [PLACEHOLDER_ELEMENT] : null;
 
-	var func = compileToken(token, opts, context);
+		var func = compileToken(token, opts, context);
 
-	if(func === falseFunc) return falseFunc;
-	if(func === trueFunc)  return function(elem){
-			return getChildren(elem).some(isTag) && next(elem);
-		};
+		if(func === falseFunc) return falseFunc;
+		if(func === trueFunc){
+			return function(elem){
+				return adapter.getChildren(elem).some(adapter.isTag) && next(elem);
+			};
+		}
 
-	func = wrap(func);
+		func = wrap(func);
 
-    if(context){
-        return function has(elem){
-		return next(elem) && (
-                (context[0] = elem), existsOne(func, getChildren(elem))
-            );
-	};
-    }
+		if(context){
+			return function has(elem){
+				return next(elem) && (
+					(context[0] = elem), adapter.existsOne(func, adapter.getChildren(elem))
+				);
+			};
+		}
 
-    return function has(elem){
-		return next(elem) && existsOne(func, getChildren(elem));
+		return function has(elem){
+			return next(elem) && adapter.existsOne(func, adapter.getChildren(elem));
+		};
 	};
-};
 
-filters.matches = function(next, token, options, context){
-	var opts = {
-		xmlMode: !!(options && options.xmlMode),
-		strict: !!(options && options.strict),
-		rootFunc: next
+	filters.matches = function(next, token, options, context){
+		var opts = {
+			xmlMode: !!(options && options.xmlMode),
+			strict: !!(options && options.strict),
+			rootFunc: next
+		};
+
+		return compileToken(token, opts, context);
 	};
 
-	return compileToken(token, opts, context);
-};
+	compile.compileToken = compileToken;
+	compile.compileUnsafe = compileUnsafe;
+	compile.Pseudos = Pseudos;
+
+	return compile;
+}
diff --git a/lib/general.js b/lib/general.js
index fbc960f..a167dbb 100644
--- a/lib/general.js
+++ b/lib/general.js
@@ -1,89 +1,99 @@
-var DomUtils    = require("domutils"),
-    isTag       = DomUtils.isTag,
-    getParent   = DomUtils.getParent,
-    getChildren = DomUtils.getChildren,
-    getSiblings = DomUtils.getSiblings,
-    getName     = DomUtils.getName;
-
-/*
-	all available rules
-*/
-module.exports = {
-	__proto__: null,
-
-	attribute: require("./attributes.js").compile,
-	pseudo: require("./pseudos.js").compile,
-
-	//tags
-	tag: function(next, data){
-		var name = data.name;
-		return function tag(elem){
-			return getName(elem) === name && next(elem);
-		};
-	},
-
-	//traversal
-	descendant: function(next, rule, options, context, acceptSelf){
-		return function descendant(elem){
-
-			if (acceptSelf && next(elem)) return true;
-
-			var found = false;
-
-			while(!found && (elem = getParent(elem))){
-				found = next(elem);
-			}
+var attributeFactory = require("./attributes.js");
 
-			return found;
-		};
-	},
-	parent: function(next, data, options){
-		if(options && options.strict) throw SyntaxError("Parent selector isn't part of CSS3");
+function generalFactory(adapter, Pseudos){
+	/*
+		all available rules
+	*/
+	return {
+		__proto__: null,
 
-		return function parent(elem){
-			return getChildren(elem).some(test);
-		};
+		attribute: attributeFactory(adapter).compile,
+		pseudo: Pseudos.compile,
 
-		function test(elem){
-			return isTag(elem) && next(elem);
-		}
-	},
-	child: function(next){
-		return function child(elem){
-			var parent = getParent(elem);
-			return !!parent && next(parent);
-		};
-	},
-	sibling: function(next){
-		return function sibling(elem){
-			var siblings = getSiblings(elem);
-
-			for(var i = 0; i < siblings.length; i++){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					if(next(siblings[i])) return true;
+		//tags
+		tag: function(next, data){
+			var name = data.name;
+			return function tag(elem){
+				return adapter.getName(elem) === name && next(elem);
+			};
+		},
+
+		//traversal
+		descendant: function(next){
+			return function descendant(elem){
+
+				var found = false;
+
+				while(!found && (elem = adapter.getParent(elem))){
+					found = next(elem);
 				}
-			}
 
-			return false;
-		};
-	},
-	adjacent: function(next){
-		return function adjacent(elem){
-			var siblings = getSiblings(elem),
-			    lastElement;
-
-			for(var i = 0; i < siblings.length; i++){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					lastElement = siblings[i];
+				return found;
+			};
+		},
+		_flexibleDescendant: function(next){
+			// Include element itself, only used while querying an array
+			return function descendant(elem){
+
+				var found = next(elem);
+
+				while(!found && (elem = adapter.getParent(elem))){
+					found = next(elem);
 				}
+
+				return found;
+			};
+		},
+		parent: function(next, data, options){
+			if(options && options.strict) throw new Error("Parent selector isn't part of CSS3");
+
+			return function parent(elem){
+				return adapter.getChildren(elem).some(test);
+			};
+
+			function test(elem){
+				return adapter.isTag(elem) && next(elem);
 			}
+		},
+		child: function(next){
+			return function child(elem){
+				var parent = adapter.getParent(elem);
+				return !!parent && next(parent);
+			};
+		},
+		sibling: function(next){
+			return function sibling(elem){
+				var siblings = adapter.getSiblings(elem);
+
+				for(var i = 0; i < siblings.length; i++){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						if(next(siblings[i])) return true;
+					}
+				}
+
+				return false;
+			};
+		},
+		adjacent: function(next){
+			return function adjacent(elem){
+				var siblings = adapter.getSiblings(elem),
+					lastElement;
+
+				for(var i = 0; i < siblings.length; i++){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						lastElement = siblings[i];
+					}
+				}
+
+				return !!lastElement && next(lastElement);
+			};
+		},
+		universal: function(next){
+			return next;
+		}
+	};
+}
 
-			return !!lastElement && next(lastElement);
-		};
-	},
-	universal: function(next){
-		return next;
-	}
-};
\ No newline at end of file
+module.exports = generalFactory;
diff --git a/lib/pseudos.js b/lib/pseudos.js
index f6774ec..5d0d62d 100644
--- a/lib/pseudos.js
+++ b/lib/pseudos.js
@@ -11,351 +11,359 @@
 	  they need to return a boolean
 */
 
-var DomUtils    = require("domutils"),
-    isTag       = DomUtils.isTag,
-    getText     = DomUtils.getText,
-    getParent   = DomUtils.getParent,
-    getChildren = DomUtils.getChildren,
-    getSiblings = DomUtils.getSiblings,
-    hasAttrib   = DomUtils.hasAttrib,
-    getName     = DomUtils.getName,
-    getAttribute= DomUtils.getAttributeValue,
-    getNCheck   = require("nth-check"),
-    checkAttrib = require("./attributes.js").rules.equals,
-    BaseFuncs   = require("boolbase"),
-    trueFunc    = BaseFuncs.trueFunc,
-    falseFunc   = BaseFuncs.falseFunc;
-
-//helper methods
-function getFirstElement(elems){
-	for(var i = 0; elems && i < elems.length; i++){
-		if(isTag(elems[i])) return elems[i];
-	}
-}
+var getNCheck         = require("nth-check"),
+	BaseFuncs         = require("boolbase"),
+	attributesFactory = require("./attributes.js"),
+	trueFunc          = BaseFuncs.trueFunc,
+	falseFunc         = BaseFuncs.falseFunc;
 
-function getAttribFunc(name, value){
-	var data = {name: name, value: value};
-	return function attribFunc(next){
-		return checkAttrib(next, data);
-	};
-}
+function filtersFactory(adapter){
+	var attributes  = attributesFactory(adapter),
+		checkAttrib = attributes.rules.equals;
 
-function getChildFunc(next){
-	return function(elem){
-		return !!getParent(elem) && next(elem);
-	};
-}
+	//helper methods
+	function equals(a, b){
+		if(typeof adapter.equals === "function") return adapter.equals(a, b);
+
+		return a === b;
+	}
 
-var filters = {
-	contains: function(next, text){
-		return function contains(elem){
-			return next(elem) && getText(elem).indexOf(text) >= 0;
+	function getAttribFunc(name, value){
+		var data = {name: name, value: value};
+		return function attribFunc(next){
+			return checkAttrib(next, data);
 		};
-	},
-	icontains: function(next, text){
-		var itext = text.toLowerCase();
-		return function icontains(elem){
-			return next(elem) &&
-				getText(elem).toLowerCase().indexOf(itext) >= 0;
+	}
+
+	function getChildFunc(next){
+		return function(elem){
+			return !!adapter.getParent(elem) && next(elem);
 		};
-	},
+	}
+
+	var filters = {
+		contains: function(next, text){
+			return function contains(elem){
+				return next(elem) && adapter.getText(elem).indexOf(text) >= 0;
+			};
+		},
+		icontains: function(next, text){
+			var itext = text.toLowerCase();
+			return function icontains(elem){
+				return next(elem) &&
+					adapter.getText(elem).toLowerCase().indexOf(itext) >= 0;
+			};
+		},
 
-	//location specific methods
-	"nth-child": function(next, rule){
-		var func = getNCheck(rule);
+		//location specific methods
+		"nth-child": function(next, rule){
+			var func = getNCheck(rule);
 
-		if(func === falseFunc) return func;
-		if(func === trueFunc)  return getChildFunc(next);
+			if(func === falseFunc) return func;
+			if(func === trueFunc)  return getChildFunc(next);
 
-		return function nthChild(elem){
-			var siblings = getSiblings(elem);
+			return function nthChild(elem){
+				var siblings = adapter.getSiblings(elem);
 
-			for(var i = 0, pos = 0; i < siblings.length; i++){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					else pos++;
+				for(var i = 0, pos = 0; i < siblings.length; i++){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						else pos++;
+					}
 				}
-			}
 
-			return func(pos) && next(elem);
-		};
-	},
-	"nth-last-child": function(next, rule){
-		var func = getNCheck(rule);
+				return func(pos) && next(elem);
+			};
+		},
+		"nth-last-child": function(next, rule){
+			var func = getNCheck(rule);
 
-		if(func === falseFunc) return func;
-		if(func === trueFunc)  return getChildFunc(next);
+			if(func === falseFunc) return func;
+			if(func === trueFunc)  return getChildFunc(next);
 
-		return function nthLastChild(elem){
-			var siblings = getSiblings(elem);
+			return function nthLastChild(elem){
+				var siblings = adapter.getSiblings(elem);
 
-			for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					else pos++;
+				for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						else pos++;
+					}
 				}
-			}
 
-			return func(pos) && next(elem);
-		};
-	},
-	"nth-of-type": function(next, rule){
-		var func = getNCheck(rule);
+				return func(pos) && next(elem);
+			};
+		},
+		"nth-of-type": function(next, rule){
+			var func = getNCheck(rule);
 
-		if(func === falseFunc) return func;
-		if(func === trueFunc)  return getChildFunc(next);
+			if(func === falseFunc) return func;
+			if(func === trueFunc)  return getChildFunc(next);
 
-		return function nthOfType(elem){
-			var siblings = getSiblings(elem);
+			return function nthOfType(elem){
+				var siblings = adapter.getSiblings(elem);
 
-			for(var pos = 0, i = 0; i < siblings.length; i++){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					if(getName(siblings[i]) === getName(elem)) pos++;
+				for(var pos = 0, i = 0; i < siblings.length; i++){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						if(adapter.getName(siblings[i]) === adapter.getName(elem)) pos++;
+					}
 				}
-			}
 
-			return func(pos) && next(elem);
-		};
-	},
-	"nth-last-of-type": function(next, rule){
-		var func = getNCheck(rule);
+				return func(pos) && next(elem);
+			};
+		},
+		"nth-last-of-type": function(next, rule){
+			var func = getNCheck(rule);
 
-		if(func === falseFunc) return func;
-		if(func === trueFunc)  return getChildFunc(next);
+			if(func === falseFunc) return func;
+			if(func === trueFunc)  return getChildFunc(next);
 
-		return function nthLastOfType(elem){
-			var siblings = getSiblings(elem);
+			return function nthLastOfType(elem){
+				var siblings = adapter.getSiblings(elem);
 
-			for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
-				if(isTag(siblings[i])){
-					if(siblings[i] === elem) break;
-					if(getName(siblings[i]) === getName(elem)) pos++;
+				for(var pos = 0, i = siblings.length - 1; i >= 0; i--){
+					if(adapter.isTag(siblings[i])){
+						if(siblings[i] === elem) break;
+						if(adapter.getName(siblings[i]) === adapter.getName(elem)) pos++;
+					}
 				}
+
+				return func(pos) && next(elem);
+			};
+		},
+
+		//TODO determine the actual root element
+		root: function(next){
+			return function(elem){
+				return !adapter.getParent(elem) && next(elem);
+			};
+		},
+
+		scope: function(next, rule, options, context){
+			if(!context || context.length === 0){
+				//equivalent to :root
+				return filters.root(next);
 			}
 
-			return func(pos) && next(elem);
-		};
-	},
-
-    //TODO determine the actual root element
-    root: function(next){
-        return function(elem){
-            return !getParent(elem) && next(elem);
-        };
-    },
-
-    scope: function(next, rule, options, context){
-        if(!context || context.length === 0){
-            //equivalent to :root
-            return filters.root(next);
-        }
-
-        if(context.length === 1){
-            //NOTE: can't be unpacked, as :has uses this for side-effects
-            return function(elem){
-                return context[0] === elem && next(elem);
-            };
-        }
-
-        return function(elem){
-            return context.indexOf(elem) >= 0 && next(elem);
-        };
-    },
-
-	//jQuery extensions (others follow as pseudos)
-	checkbox: getAttribFunc("type", "checkbox"),
-	file: getAttribFunc("type", "file"),
-	password: getAttribFunc("type", "password"),
-	radio: getAttribFunc("type", "radio"),
-	reset: getAttribFunc("type", "reset"),
-	image: getAttribFunc("type", "image"),
-	submit: getAttribFunc("type", "submit")
-};
-
-//while filters are precompiled, pseudos get called when they are needed
-var pseudos = {
-	empty: function(elem){
-		return !getChildren(elem).some(function(elem){
-			return isTag(elem) || elem.type === "text";
-		});
-	},
-
-	"first-child": function(elem){
-		return getFirstElement(getSiblings(elem)) === elem;
-	},
-	"last-child": function(elem){
-		var siblings = getSiblings(elem);
-
-		for(var i = siblings.length - 1; i >= 0; i--){
-			if(siblings[i] === elem) return true;
-			if(isTag(siblings[i])) break;
-		}
+			if(context.length === 1){
+				//NOTE: can't be unpacked, as :has uses this for side-effects
+				return function(elem){
+					return equals(context[0], elem) && next(elem);
+				};
+			}
 
-		return false;
-	},
-	"first-of-type": function(elem){
-		var siblings = getSiblings(elem);
+			return function(elem){
+				return context.indexOf(elem) >= 0 && next(elem);
+			};
+		},
+
+		//jQuery extensions (others follow as pseudos)
+		checkbox: getAttribFunc("type", "checkbox"),
+		file: getAttribFunc("type", "file"),
+		password: getAttribFunc("type", "password"),
+		radio: getAttribFunc("type", "radio"),
+		reset: getAttribFunc("type", "reset"),
+		image: getAttribFunc("type", "image"),
+		submit: getAttribFunc("type", "submit")
+	};
+	return filters;
+}
+
+function pseudosFactory(adapter){
+	//helper methods
+	function getFirstElement(elems){
+		for(var i = 0; elems && i < elems.length; i++){
+			if(adapter.isTag(elems[i])) return elems[i];
+		}
+	}
 
-		for(var i = 0; i < siblings.length; i++){
-			if(isTag(siblings[i])){
+	//while filters are precompiled, pseudos get called when they are needed
+	var pseudos = {
+		empty: function(elem){
+			return !adapter.getChildren(elem).some(function(elem){
+				return adapter.isTag(elem) || elem.type === "text";
+			});
+		},
+
+		"first-child": function(elem){
+			return getFirstElement(adapter.getSiblings(elem)) === elem;
+		},
+		"last-child": function(elem){
+			var siblings = adapter.getSiblings(elem);
+
+			for(var i = siblings.length - 1; i >= 0; i--){
 				if(siblings[i] === elem) return true;
-				if(getName(siblings[i]) === getName(elem)) break;
+				if(adapter.isTag(siblings[i])) break;
 			}
-		}
 
-		return false;
-	},
-	"last-of-type": function(elem){
-		var siblings = getSiblings(elem);
+			return false;
+		},
+		"first-of-type": function(elem){
+			var siblings = adapter.getSiblings(elem);
 
-		for(var i = siblings.length-1; i >= 0; i--){
-			if(isTag(siblings[i])){
-				if(siblings[i] === elem) return true;
-				if(getName(siblings[i]) === getName(elem)) break;
+			for(var i = 0; i < siblings.length; i++){
+				if(adapter.isTag(siblings[i])){
+					if(siblings[i] === elem) return true;
+					if(adapter.getName(siblings[i]) === adapter.getName(elem)) break;
+				}
 			}
-		}
 
-		return false;
-	},
-	"only-of-type": function(elem){
-		var siblings = getSiblings(elem);
+			return false;
+		},
+		"last-of-type": function(elem){
+			var siblings = adapter.getSiblings(elem);
 
-		for(var i = 0, j = siblings.length; i < j; i++){
-			if(isTag(siblings[i])){
-				if(siblings[i] === elem) continue;
-				if(getName(siblings[i]) === getName(elem)) return false;
+			for(var i = siblings.length - 1; i >= 0; i--){
+				if(adapter.isTag(siblings[i])){
+					if(siblings[i] === elem) return true;
+					if(adapter.getName(siblings[i]) === adapter.getName(elem)) break;
+				}
 			}
-		}
 
-		return true;
-	},
-	"only-child": function(elem){
-		var siblings = getSiblings(elem);
+			return false;
+		},
+		"only-of-type": function(elem){
+			var siblings = adapter.getSiblings(elem);
 
-		for(var i = 0; i < siblings.length; i++){
-			if(isTag(siblings[i]) && siblings[i] !== elem) return false;
-		}
+			for(var i = 0, j = siblings.length; i < j; i++){
+				if(adapter.isTag(siblings[i])){
+					if(siblings[i] === elem) continue;
+					if(adapter.getName(siblings[i]) === adapter.getName(elem)) return false;
+				}
+			}
+
+			return true;
+		},
+		"only-child": function(elem){
+			var siblings = adapter.getSiblings(elem);
 
-		return true;
-	},
-
-	//:matches(a, area, link)[href]
-	link: function(elem){
-		return hasAttrib(elem, "href");
-	},
-	visited: falseFunc, //seems to be a valid implementation
-	//TODO: :any-link once the name is finalized (as an alias of :link)
-
-	//forms
-	//to consider: :target
-
-	//:matches([selected], select:not([multiple]):not(> option[selected]) > option:first-of-type)
-	selected: function(elem){
-		if(hasAttrib(elem, "selected")) return true;
-		else if(getName(elem) !== "option") return false;
-
-		//the first <option> in a <select> is also selected
-		var parent = getParent(elem);
-
-		if(
-			!parent ||
-			getName(parent) !== "select" ||
-			hasAttrib(parent, "multiple")
-		) return false;
-
-		var siblings = getChildren(parent),
-			sawElem  = false;
-
-		for(var i = 0; i < siblings.length; i++){
-			if(isTag(siblings[i])){
-				if(siblings[i] === elem){
-					sawElem = true;
-				} else if(!sawElem){
-					return false;
-				} else if(hasAttrib(siblings[i], "selected")){
-					return false;
+			for(var i = 0; i < siblings.length; i++){
+				if(adapter.isTag(siblings[i]) && siblings[i] !== elem) return false;
+			}
+
+			return true;
+		},
+
+		//:matches(a, area, link)[href]
+		link: function(elem){
+			return adapter.hasAttrib(elem, "href");
+		},
+		visited: falseFunc, //seems to be a valid implementation
+		//TODO: :any-link once the name is finalized (as an alias of :link)
+
+		//forms
+		//to consider: :target
+
+		//:matches([selected], select:not([multiple]):not(> option[selected]) > option:first-of-type)
+		selected: function(elem){
+			if(adapter.hasAttrib(elem, "selected")) return true;
+			else if(adapter.getName(elem) !== "option") return false;
+
+			//the first <option> in a <select> is also selected
+			var parent = adapter.getParent(elem);
+
+			if(
+				!parent ||
+				adapter.getName(parent) !== "select" ||
+				adapter.hasAttrib(parent, "multiple")
+			) return false;
+
+			var siblings = adapter.getChildren(parent),
+				sawElem  = false;
+
+			for(var i = 0; i < siblings.length; i++){
+				if(adapter.isTag(siblings[i])){
+					if(siblings[i] === elem){
+						sawElem = true;
+					} else if(!sawElem){
+						return false;
+					} else if(adapter.hasAttrib(siblings[i], "selected")){
+						return false;
+					}
 				}
 			}
+
+			return sawElem;
+		},
+		//https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements
+		//:matches(
+		//  :matches(button, input, select, textarea, menuitem, optgroup, option)[disabled],
+		//  optgroup[disabled] > option),
+		// fieldset[disabled] * //TODO not child of first <legend>
+		//)
+		disabled: function(elem){
+			return adapter.hasAttrib(elem, "disabled");
+		},
+		enabled: function(elem){
+			return !adapter.hasAttrib(elem, "disabled");
+		},
+		//:matches(:matches(:radio, :checkbox)[checked], :selected) (TODO menuitem)
+		checked: function(elem){
+			return adapter.hasAttrib(elem, "checked") || pseudos.selected(elem);
+		},
+		//:matches(input, select, textarea)[required]
+		required: function(elem){
+			return adapter.hasAttrib(elem, "required");
+		},
+		//:matches(input, select, textarea):not([required])
+		optional: function(elem){
+			return !adapter.hasAttrib(elem, "required");
+		},
+
+		//jQuery extensions
+
+		//:not(:empty)
+		parent: function(elem){
+			return !pseudos.empty(elem);
+		},
+		//:matches(h1, h2, h3, h4, h5, h6)
+		header: function(elem){
+			var name = adapter.getName(elem);
+			return name === "h1" ||
+					name === "h2" ||
+					name === "h3" ||
+					name === "h4" ||
+					name === "h5" ||
+					name === "h6";
+		},
+
+		//:matches(button, input[type=button])
+		button: function(elem){
+			var name = adapter.getName(elem);
+			return name === "button" ||
+					name === "input" &&
+					adapter.getAttributeValue(elem, "type") === "button";
+		},
+		//:matches(input, textarea, select, button)
+		input: function(elem){
+			var name = adapter.getName(elem);
+			return name === "input" ||
+					name === "textarea" ||
+					name === "select" ||
+					name === "button";
+		},
+		//input:matches(:not([type!='']), [type='text' i])
+		text: function(elem){
+			var attr;
+			return adapter.getName(elem) === "input" && (
+				!(attr = adapter.getAttributeValue(elem, "type")) ||
+				attr.toLowerCase() === "text"
+			);
 		}
+	};
 
-		return sawElem;
-	},
-	//https://html.spec.whatwg.org/multipage/scripting.html#disabled-elements
-	//:matches(
-	//  :matches(button, input, select, textarea, menuitem, optgroup, option)[disabled],
-	//  optgroup[disabled] > option),
-	// fieldset[disabled] * //TODO not child of first <legend>
-	//)
-	disabled: function(elem){
-		return hasAttrib(elem, "disabled");
-	},
-	enabled: function(elem){
-		return !hasAttrib(elem, "disabled");
-	},
-	//:matches(:matches(:radio, :checkbox)[checked], :selected) (TODO menuitem)
-	checked: function(elem){
-		return hasAttrib(elem, "checked") || pseudos.selected(elem);
-	},
-	//:matches(input, select, textarea)[required]
-	required: function(elem){
-		return hasAttrib(elem, "required");
-	},
-	//:matches(input, select, textarea):not([required])
-	optional: function(elem){
-		return !hasAttrib(elem, "required");
-	},
-
-	//jQuery extensions
-
-	//:not(:empty)
-	parent: function(elem){
-		return !pseudos.empty(elem);
-	},
-	//:matches(h1, h2, h3, h4, h5, h6)
-	header: function(elem){
-		var name = getName(elem);
-		return name === "h1" ||
-		       name === "h2" ||
-		       name === "h3" ||
-		       name === "h4" ||
-		       name === "h5" ||
-		       name === "h6";
-	},
-
-	//:matches(button, input[type=button])
-	button: function(elem){
-		var name = getName(elem);
-		return name === "button" ||
-		       name === "input" &&
-		       getAttribute(elem, "type") === "button";
-	},
-	//:matches(input, textarea, select, button)
-	input: function(elem){
-		var name = getName(elem);
-		return name === "input" ||
-		       name === "textarea" ||
-		       name === "select" ||
-		       name === "button";
-	},
-	//input:matches(:not([type!='']), [type='text' i])
-	text: function(elem){
-		var attr;
-		return getName(elem) === "input" && (
-			!(attr = getAttribute(elem, "type")) ||
-			attr.toLowerCase() === "text"
-		);
-	}
-};
+	return pseudos;
+}
 
 function verifyArgs(func, name, subselect){
 	if(subselect === null){
 		if(func.length > 1 && name !== "scope"){
-			throw new SyntaxError("pseudo-selector :" + name + " requires an argument");
+			throw new Error("pseudo-selector :" + name + " requires an argument");
 		}
 	} else {
 		if(func.length === 1){
-			throw new SyntaxError("pseudo-selector :" + name + " doesn't have any arguments");
+			throw new Error("pseudo-selector :" + name + " doesn't have any arguments");
 		}
 	}
 }
@@ -363,31 +371,38 @@ function verifyArgs(func, name, subselect){
 //FIXME this feels hacky
 var re_CSS3 = /^(?:(?:nth|last|first|only)-(?:child|of-type)|root|empty|(?:en|dis)abled|checked|not)$/;
 
-module.exports = {
-	compile: function(next, data, options, context){
-		var name = data.name,
-			subselect = data.data;
+function factory(adapter){
+	var pseudos = pseudosFactory(adapter);
+	var filters = filtersFactory(adapter);
 
-		if(options && options.strict && !re_CSS3.test(name)){
-			throw SyntaxError(":" + name + " isn't part of CSS3");
-		}
+	return {
+		compile: function(next, data, options, context){
+			var name = data.name,
+				subselect = data.data;
 
-		if(typeof filters[name] === "function"){
-			verifyArgs(filters[name], name,  subselect);
-			return filters[name](next, subselect, options, context);
-		} else if(typeof pseudos[name] === "function"){
-			var func = pseudos[name];
-			verifyArgs(func, name, subselect);
+			if(options && options.strict && !re_CSS3.test(name)){
+				throw new Error(":" + name + " isn't part of CSS3");
+			}
 
-			if(next === trueFunc) return func;
+			if(typeof filters[name] === "function"){
+				verifyArgs(filters[name], name,  subselect);
+				return filters[name](next, subselect, options, context);
+			} else if(typeof pseudos[name] === "function"){
+				var func = pseudos[name];
+				verifyArgs(func, name, subselect);
 
-			return function pseudoArgs(elem){
-				return func(elem, subselect) && next(elem);
-			};
-		} else {
-			throw new SyntaxError("unmatched pseudo-class :" + name);
-		}
-	},
-	filters: filters,
-	pseudos: pseudos
-};
+				if(next === trueFunc) return func;
+
+				return function pseudoArgs(elem){
+					return func(elem, subselect) && next(elem);
+				};
+			} else {
+				throw new Error("unmatched pseudo-class :" + name);
+			}
+		},
+		filters: filters,
+		pseudos: pseudos
+	};
+}
+
+module.exports = factory;
diff --git a/package.json b/package.json
index dc14b25..39fb53c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "css-select",
-  "version": "1.2.0",
+  "version": "1.3.0-rc0",
   "description": "a CSS selector compiler/engine",
   "author": "Felix Boehm <me at feedic.com>",
   "keywords": [
@@ -17,45 +17,26 @@
     "lib"
   ],
   "dependencies": {
+    "boolbase": "^1.0.0",
     "css-what": "2.1",
     "domutils": "1.5.1",
-    "boolbase": "~1.0.0",
-    "nth-check": "~1.0.1"
+    "nth-check": "^1.0.1"
   },
   "devDependencies": {
-    "htmlparser2": "*",
     "cheerio-soupselect": "*",
-    "mocha": "*",
-    "mocha-lcov-reporter": "*",
     "coveralls": "*",
-    "istanbul": "*",
+    "eslint": "^3.0.0",
     "expect.js": "*",
-    "jshint": "2"
+    "htmlparser2": "*",
+    "istanbul": "*",
+    "mocha": "*",
+    "mocha-lcov-reporter": "*"
   },
   "scripts": {
     "test": "mocha && npm run lint",
-    "lint": "jshint index.js lib/*.js test/*.js",
+    "lint": "eslint index.js lib/*.js test/*.js",
     "lcov": "istanbul cover _mocha --report lcovonly -- -R spec",
     "coveralls": "npm run lint && npm run lcov && (cat coverage/lcov.info | coveralls || exit 0)"
   },
-  "license": "BSD-like",
-  "jshintConfig": {
-    "eqeqeq": true,
-    "freeze": true,
-    "latedef": "nofunc",
-    "noarg": true,
-    "nonbsp": true,
-    "quotmark": "double",
-    "undef": true,
-    "unused": true,
-    "trailing": true,
-    "eqnull": true,
-    "proto": true,
-    "smarttabs": true,
-    "node": true,
-    "globals": {
-      "describe": true,
-      "it": true
-    }
-  }
+  "license": "BSD-like"
 }
diff --git a/test/api.js b/test/api.js
index a40b53f..3c01f41 100644
--- a/test/api.js
+++ b/test/api.js
@@ -1,10 +1,10 @@
 var CSSselect = require(".."),
-    makeDom = require("htmlparser2").parseDOM,
-    bools = require("boolbase"),
-    assert = require("assert");
+	makeDom = require("htmlparser2").parseDOM,
+	bools = require("boolbase"),
+	assert = require("assert");
 
 var dom = makeDom("<div id=foo><p>foo</p></div>")[0],
-    xmlDom = makeDom("<DiV id=foo><P>foo</P></DiV>", {xmlMode: true})[0];
+	xmlDom = makeDom("<DiV id=foo><P>foo</P></DiV>", {xmlMode: true})[0];
 
 describe("API", function(){
 	describe("removes duplicates", function(){
@@ -32,13 +32,13 @@ describe("API", function(){
 	});
 
 	describe("selectAll", function(){
-		it("should query array elements directly when they have no parents", function() {
+		it("should query array elements directly when they have no parents", function(){
 			var divs = [dom];
-			assert.deepEqual(CSSselect("div", divs), divs);
+			assert.deepEqual(CSSselect.selectAll("div", divs), divs);
 		});
-		it("should query array elements directly when they have parents", function() {
-			var ps = CSSselect("p", [dom]);
-			assert.deepEqual(CSSselect("p", ps), ps);
+		it("should query array elements directly when they have parents", function(){
+			var ps = CSSselect.selectAll("p", [dom]);
+			assert.deepEqual(CSSselect.selectAll("p", ps), ps);
 		});
 	});
 
@@ -128,19 +128,19 @@ describe("API", function(){
 
 		it("should be strict", function(){
 			var opts = {strict: true};
-			assert.throws(CSSselect.compile.bind(null, ":checkbox", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, "[attr=val i]", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, "[attr!=val]", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, "[attr!=val i]", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, "foo < bar", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, ":not(:parent)", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, ":not(a > b)", opts), SyntaxError);
-			assert.throws(CSSselect.compile.bind(null, ":not(a, b)",  opts), SyntaxError);
+			assert.throws(CSSselect.compile.bind(null, ":checkbox", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, "[attr=val i]", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, "[attr!=val]", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, "[attr!=val i]", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, "foo < bar", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, ":not(:parent)", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, ":not(a > b)", opts), Error);
+			assert.throws(CSSselect.compile.bind(null, ":not(a, b)",  opts), Error);
 		});
 
 		it("should recognize contexts", function(){
-			var div = CSSselect("div", [dom]),
-			    p = CSSselect("p", [dom]);
+			var div = CSSselect.selectAll("div", [dom]),
+			    p = CSSselect.selectAll("p", [dom]);
 
 			assert.equal(CSSselect.selectOne("div", div, {context: div}), div[0]);
 			assert.equal(CSSselect.selectOne("div", div, {context: p}), null);
diff --git a/test/attributes.js b/test/attributes.js
index 254be83..74d2f14 100644
--- a/test/attributes.js
+++ b/test/attributes.js
@@ -1,7 +1,7 @@
 var CSSselect = require("../"),
-    makeDom = require("htmlparser2").parseDOM,
-    falseFunc = require("boolbase").falseFunc,
-    assert = require("assert");
+	makeDom = require("htmlparser2").parseDOM,
+	falseFunc = require("boolbase").falseFunc,
+	assert = require("assert");
 
 var dom = makeDom("<div><div data-foo=\"In the end, it doesn't really matter.\"></div><div data-foo=\"Indeed-that's a delicate matter.\">");
 
diff --git a/test/icontains.js b/test/icontains.js
index 748c764..79b7768 100644
--- a/test/icontains.js
+++ b/test/icontains.js
@@ -1,6 +1,6 @@
 var CSSselect = require("../"),
-    makeDom = require("htmlparser2").parseDOM,
-    assert = require("assert");
+	makeDom = require("htmlparser2").parseDOM,
+	assert = require("assert");
 
 var dom = makeDom("<div><p>In the end, it doesn't really Matter.</p><div>Indeed-that's a delicate matter.</div>");
 
@@ -37,29 +37,29 @@ describe("icontains", function(){
 			var matches = CSSselect.selectAll(":icontains(matter)", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
+				dom[0].children[1]]);
 			matches = CSSselect.selectAll(":icontains(mATter)", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
+				dom[0].children[1]]);
 		});
 
 		it("should match empty string", function(){
-            var matches = CSSselect.selectAll(":icontains()", dom);
+			var matches = CSSselect.selectAll(":icontains()", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
+				dom[0].children[1]]);
 		});
 
 		it("should match quoted string", function(){
-            var matches = CSSselect.selectAll(":icontains('')", dom);
+			var matches = CSSselect.selectAll(":icontains('')", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
-            matches = CSSselect.selectAll("p:icontains('matter')", dom);
+				dom[0].children[1]]);
+			matches = CSSselect.selectAll("p:icontains('matter')", dom);
 			assert.equal(matches.length, 1);
 			assert.deepEqual(matches, [dom[0].children[0]]);
-            matches = CSSselect.selectAll("p:icontains(\"matter\")", dom);
+			matches = CSSselect.selectAll("p:icontains(\"matter\")", dom);
 			assert.equal(matches.length, 1);
 			assert.deepEqual(matches, [dom[0].children[0]]);
 		});
@@ -68,19 +68,19 @@ describe("icontains", function(){
 			var matches = CSSselect.selectAll(":icontains( matter)", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
+				dom[0].children[1]]);
 			matches = CSSselect.selectAll(":icontains( mATter)", dom);
 			assert.equal(matches.length, 3);
 			assert.deepEqual(matches, [dom[0], dom[0].children[0],
-                dom[0].children[1]]);
+				dom[0].children[1]]);
 		});
-    });
+	});
 
 	describe("no matches", function(){
 		it("should not match", function(){
-            var matches = CSSselect.selectAll("p:icontains(indeed)", dom);
+			var matches = CSSselect.selectAll("p:icontains(indeed)", dom);
 			assert.equal(matches.length, 0);
 		});
 
-    });
+	});
 });
diff --git a/test/nwmatcher/index.js b/test/nwmatcher/index.js
index a478b03..663b066 100644
--- a/test/nwmatcher/index.js
+++ b/test/nwmatcher/index.js
@@ -17,17 +17,17 @@ function getById(element){
 		}
 		return element;
 	}
-	else return Array.prototype.map.call(arguments, function(elem){
-			return getById(elem);
-		});
+	else {return Array.prototype.map.call(arguments, function(elem){
+		return getById(elem);
+	});}
 }
 
 //NWMatcher methods
 var select = function(query, doc){
-	if(arguments.length === 1 || typeof doc === "undefined") doc = document;
-	else if(typeof doc === "string") doc = select(doc);
-	return CSSselect(query, doc);
-}, match = CSSselect.is;
+		if(arguments.length === 1 || typeof doc === "undefined") doc = document;
+		else if(typeof doc === "string") doc = select(doc);
+		return CSSselect(query, doc);
+	}, match = CSSselect.is;
 
 var validators = {
 	assert: assert,
@@ -79,7 +79,7 @@ var RUN_BENCHMARKS = false;
 		"E": function(){
 			//Type selector
 			var results = [], index = 0, nodes = document.getElementsByTagName("li");
-			while((results[index] = nodes[index++])){}
+			while((results[index] = nodes[index++]));
 			results.length--;
 			//  this.assertEquivalent(select("li"), results); //TODO
 			this.assertEqual(select("strong", getById("fixtures"))[0], getById("strong"));
@@ -93,7 +93,7 @@ var RUN_BENCHMARKS = false;
 		},
 		".class": function(){
 			//Class selector
-			this.assertEquivalent(select(".first"), getById('p', 'link_1', 'item_1'));
+			this.assertEquivalent(select(".first"), getById("p", "link_1", "item_1"));
 			this.assertEquivalent(select(".second"), []);
 		},
 		"E#id": function(){
@@ -102,102 +102,102 @@ var RUN_BENCHMARKS = false;
 		},
 		"E.class": function(){
 			var secondLink = getById("link_2");
-			this.assertEquivalent(select('a.internal'), getById('link_1', 'link_2'));
-			this.assertEqual(select('a.internal.highlight')[0], secondLink);
-			this.assertEqual(select('a.highlight.internal')[0], secondLink);
-			this.assertEquivalent(select('a.highlight.internal.nonexistent'), []);
+			this.assertEquivalent(select("a.internal"), getById("link_1", "link_2"));
+			this.assertEqual(select("a.internal.highlight")[0], secondLink);
+			this.assertEqual(select("a.highlight.internal")[0], secondLink);
+			this.assertEquivalent(select("a.highlight.internal.nonexistent"), []);
 		},
 		"#id.class": function(){
-			var secondLink = getById('link_2');
-			this.assertEqual(select('#link_2.internal')[0], secondLink);
-			this.assertEqual(select('.internal#link_2')[0], secondLink);
-			this.assertEqual(select('#link_2.internal.highlight')[0], secondLink);
-			this.assertEquivalent(select('#link_2.internal.nonexistent'), []);
+			var secondLink = getById("link_2");
+			this.assertEqual(select("#link_2.internal")[0], secondLink);
+			this.assertEqual(select(".internal#link_2")[0], secondLink);
+			this.assertEqual(select("#link_2.internal.highlight")[0], secondLink);
+			this.assertEquivalent(select("#link_2.internal.nonexistent"), []);
 		},
 		"E#id.class": function(){
-			var secondLink = getById('link_2');
-			this.assertEqual(select('a#link_2.internal')[0], secondLink);
-			this.assertEqual(select('a.internal#link_2')[0], secondLink);
-			this.assertEqual(select('li#item_1.first')[0], getById("item_1"));
-			this.assertEquivalent(select('li#item_1.nonexistent'), []);
-			this.assertEquivalent(select('li#item_1.first.nonexistent'), []);
+			var secondLink = getById("link_2");
+			this.assertEqual(select("a#link_2.internal")[0], secondLink);
+			this.assertEqual(select("a.internal#link_2")[0], secondLink);
+			this.assertEqual(select("li#item_1.first")[0], getById("item_1"));
+			this.assertEquivalent(select("li#item_1.nonexistent"), []);
+			this.assertEquivalent(select("li#item_1.first.nonexistent"), []);
 		}
 	});
 
 	runner.addGroup("Attribute Selectors").addTests(null, {
 		"[foo]": function(){
-			this.assertEquivalent(select('[href]', document.body), select('a[href]', document.body));
-			this.assertEquivalent(select('[class~=internal]'), select('a[class~="internal"]'));
-			this.assertEquivalent(select('[id]'), select('*[id]'));
-			this.assertEquivalent(select('[type=radio]'), getById('checked_radio', 'unchecked_radio'));
-			this.assertEquivalent(select('[type=checkbox]'), select('*[type=checkbox]'));
-			this.assertEquivalent(select('[title]'), getById('with_title', 'commaParent'));
-			this.assertEquivalent(select('#troubleForm [type=radio]'), select('#troubleForm *[type=radio]'));
-			this.assertEquivalent(select('#troubleForm [type]'), select('#troubleForm *[type]'));
+			this.assertEquivalent(select("[href]", document.body), select("a[href]", document.body));
+			this.assertEquivalent(select("[class~=internal]"), select("a[class~=\"internal\"]"));
+			this.assertEquivalent(select("[id]"), select("*[id]"));
+			this.assertEquivalent(select("[type=radio]"), getById("checked_radio", "unchecked_radio"));
+			this.assertEquivalent(select("[type=checkbox]"), select("*[type=checkbox]"));
+			this.assertEquivalent(select("[title]"), getById("with_title", "commaParent"));
+			this.assertEquivalent(select("#troubleForm [type=radio]"), select("#troubleForm *[type=radio]"));
+			this.assertEquivalent(select("#troubleForm [type]"), select("#troubleForm *[type]"));
 		},
 		"E[foo]": function(){
-			this.assertEquivalent(select('h1[class]'), select('#fixtures h1'), "h1[class]");
-			this.assertEquivalent(select('h1[CLASS]'), select('#fixtures h1'), "h1[CLASS]");
-			this.assertEqual(select('li#item_3[class]')[0], getById('item_3'), "li#item_3[class]");
-			this.assertEquivalent(select('#troubleForm2 input[name="brackets[5][]"]'), getById('chk_1', 'chk_2'));
+			this.assertEquivalent(select("h1[class]"), select("#fixtures h1"), "h1[class]");
+			this.assertEquivalent(select("h1[CLASS]"), select("#fixtures h1"), "h1[CLASS]");
+			this.assertEqual(select("li#item_3[class]")[0], getById("item_3"), "li#item_3[class]");
+			this.assertEquivalent(select("#troubleForm2 input[name=\"brackets[5][]\"]"), getById("chk_1", "chk_2"));
 			//Brackets in attribute value
-			this.assertEqual(select('#troubleForm2 input[name="brackets[5][]"]:checked')[0], getById('chk_1'));
+			this.assertEqual(select("#troubleForm2 input[name=\"brackets[5][]\"]:checked")[0], getById("chk_1"));
 			//Space in attribute value
-			this.assertEqual(select('cite[title="hello world!"]')[0], getById('with_title'));
+			this.assertEqual(select("cite[title=\"hello world!\"]")[0], getById("with_title"));
 			//Namespaced attributes
 			//  this.assertEquivalent(select('[xml:lang]'), [document.documentElement, getById("item_3")]);
 			//  this.assertEquivalent(select('*[xml:lang]'), [document.documentElement, getById("item_3")]);
 		},
-		'E[foo="bar"]': function(){
-			this.assertEquivalent(select('a[href="#"]'), getById('link_1', 'link_2', 'link_3'));
+		"E[foo=\"bar\"]": function(){
+			this.assertEquivalent(select("a[href=\"#\"]"), getById("link_1", "link_2", "link_3"));
 			this.assertThrowsException(/Error/, function(){
-				select('a[href=#]');
+				select("a[href=#]");
 			});
-			this.assertEqual(select('#troubleForm2 input[name="brackets[5][]"][value="2"]')[0], getById('chk_2'));
+			this.assertEqual(select("#troubleForm2 input[name=\"brackets[5][]\"][value=\"2\"]")[0], getById("chk_2"));
 		},
-		'E[foo~="bar"]': function(){
-			this.assertEquivalent(select('a[class~="internal"]'), getById('link_1', 'link_2'), "a[class~=\"internal\"]");
-			this.assertEquivalent(select('a[class~=internal]'), getById('link_1', 'link_2'), "a[class~=internal]");
-			this.assertEqual(select('a[class~=external][href="#"]')[0], getById('link_3'), 'a[class~=external][href="#"]');
+		"E[foo~=\"bar\"]": function(){
+			this.assertEquivalent(select("a[class~=\"internal\"]"), getById("link_1", "link_2"), "a[class~=\"internal\"]");
+			this.assertEquivalent(select("a[class~=internal]"), getById("link_1", "link_2"), "a[class~=internal]");
+			this.assertEqual(select("a[class~=external][href=\"#\"]")[0], getById("link_3"), "a[class~=external][href=\"#\"]");
 		},/*
 		'E[foo|="en"]': function(){
 			this.assertEqual(select('*[xml:lang|="es"]')[0], getById('item_3'));
 			this.assertEqual(select('*[xml:lang|="ES"]')[0], getById('item_3'));
 		},*/
-		'E[foo^="bar"]': function(){
-			this.assertEquivalent(select('div[class^=bro]'), getById('father', 'uncle'), 'matching beginning of string');
-			this.assertEquivalent(select('#level1 *[id^="level2_"]'), getById('level2_1', 'level2_2', 'level2_3'));
-			this.assertEquivalent(select('#level1 *[id^=level2_]'), getById('level2_1', 'level2_2', 'level2_3'));
+		"E[foo^=\"bar\"]": function(){
+			this.assertEquivalent(select("div[class^=bro]"), getById("father", "uncle"), "matching beginning of string");
+			this.assertEquivalent(select("#level1 *[id^=\"level2_\"]"), getById("level2_1", "level2_2", "level2_3"));
+			this.assertEquivalent(select("#level1 *[id^=level2_]"), getById("level2_1", "level2_2", "level2_3"));
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[id^=level2_]');
+						select("#level1 *[id^=level2_]");
 					}, 1000);
 				}, 500);
 			}
 		},
-		'E[foo$="bar"]': function(){
-			this.assertEquivalent(select('div[class$=men]'), getById('father', 'uncle'), 'matching end of string');
-			this.assertEquivalent(select('#level1 *[id$="_1"]'), getById('level2_1', 'level3_1'));
-			this.assertEquivalent(select('#level1 *[id$=_1]'), getById('level2_1', 'level3_1'));
+		"E[foo$=\"bar\"]": function(){
+			this.assertEquivalent(select("div[class$=men]"), getById("father", "uncle"), "matching end of string");
+			this.assertEquivalent(select("#level1 *[id$=\"_1\"]"), getById("level2_1", "level3_1"));
+			this.assertEquivalent(select("#level1 *[id$=_1]"), getById("level2_1", "level3_1"));
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[id$=_1]');
+						select("#level1 *[id$=_1]");
 					}, 1000);
 				}, 500);
 			}
 		},
-		'E[foo*="bar"]': function(){
-			this.assertEquivalent(select('div[class*="ers m"]'), getById('father', 'uncle'), 'matching substring');
-			this.assertEquivalent(select('#level1 *[id*="2"]'), getById('level2_1', 'level3_2', 'level2_2', 'level2_3'));
+		"E[foo*=\"bar\"]": function(){
+			this.assertEquivalent(select("div[class*=\"ers m\"]"), getById("father", "uncle"), "matching substring");
+			this.assertEquivalent(select("#level1 *[id*=\"2\"]"), getById("level2_1", "level3_2", "level2_2", "level2_3"));
 			this.assertThrowsException(/Error/, function(){
-				select('#level1 *[id*=2]');
+				select("#level1 *[id*=2]");
 			});
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[id*=2]');
+						select("#level1 *[id*=2]");
 					}, 1000);
 				}, 500);
 			}
@@ -205,38 +205,38 @@ var RUN_BENCHMARKS = false;
 
 	// *** these should throw SYNTAX_ERR ***
 
-		'E[id=-1]': function(){
+		"E[id=-1]": function(){
 			this.assertThrowsException(/Error/, function(){
-				select('#level1 *[id=-1]');
+				select("#level1 *[id=-1]");
 			});
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[id=9]');
+						select("#level1 *[id=9]");
 					}, 1000);
 				}, 500);
 			}
 		},
-		'E[class=-45deg]': function(){
+		"E[class=-45deg]": function(){
 			this.assertThrowsException(/Error/, function(){
-				select('#level1 *[class=-45deg]');
+				select("#level1 *[class=-45deg]");
 			});
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[class=-45deg]');
+						select("#level1 *[class=-45deg]");
 					}, 1000);
 				}, 500);
 			}
 		},
-		'E[class=8mm]': function(){
+		"E[class=8mm]": function(){
 			this.assertThrowsException(/Error/, function(){
-				select('#level1 *[class=8mm]');
+				select("#level1 *[class=8mm]");
 			});
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *[class=8mm]');
+						select("#level1 *[class=8mm]");
 					}, 1000);
 				}, 500);
 			}
@@ -246,169 +246,201 @@ var RUN_BENCHMARKS = false;
 
 	runner.addGroup("Structural pseudo-classes").addTests(null, {
 		"E:first-child": function(){
-			this.assertEqual(select('#level1>*:first-child')[0], getById('level2_1'));
-			this.assertEquivalent(select('#level1 *:first-child'), getById('level2_1', 'level3_1', 'level_only_child'));
-			this.assertEquivalent(select('#level1>div:first-child'), []);
-			this.assertEquivalent(select('#level1 span:first-child'), getById('level2_1', 'level3_1'));
-			this.assertEquivalent(select('#level1:first-child'), []);
+			this.assertEqual(select("#level1>*:first-child")[0], getById("level2_1"));
+			this.assertEquivalent(select("#level1 *:first-child"), getById("level2_1", "level3_1", "level_only_child"));
+			this.assertEquivalent(select("#level1>div:first-child"), []);
+			this.assertEquivalent(select("#level1 span:first-child"), getById("level2_1", "level3_1"));
+			this.assertEquivalent(select("#level1:first-child"), []);
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *:first-child');
+						select("#level1 *:first-child");
 					}, 1000);
 				}, 500);
 			}
 		},
 		"E:last-child": function(){
-			this.assertEqual(select('#level1>*:last-child')[0], getById('level2_3'));
-			this.assertEquivalent(select('#level1 *:last-child'), getById('level3_2', 'level_only_child', 'level2_3'));
-			this.assertEqual(select('#level1>div:last-child')[0], getById('level2_3'));
-			this.assertEqual(select('#level1 div:last-child')[0], getById('level2_3'));
-			this.assertEquivalent(select('#level1>span:last-child'), []);
+			this.assertEqual(select("#level1>*:last-child")[0], getById("level2_3"));
+			this.assertEquivalent(select("#level1 *:last-child"), getById("level3_2", "level_only_child", "level2_3"));
+			this.assertEqual(select("#level1>div:last-child")[0], getById("level2_3"));
+			this.assertEqual(select("#level1 div:last-child")[0], getById("level2_3"));
+			this.assertEquivalent(select("#level1>span:last-child"), []);
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *:last-child');
+						select("#level1 *:last-child");
 					}, 1000);
 				}, 500);
 			}
 		},
 		"E:nth-child(n)": function(){
-			this.assertEqual(select('#p *:nth-child(3)')[0], getById('link_2'));
-			this.assertEqual(select('#p a:nth-child(3)')[0], getById('link_2'), 'nth-child');
-			this.assertEquivalent(select('#list > li:nth-child(n+2)'), getById('item_2', 'item_3'));
-			this.assertEquivalent(select('#list > li:nth-child(-n+2)'), getById('item_1', 'item_2'));
+			this.assertEqual(select("#p *:nth-child(3)")[0], getById("link_2"));
+			this.assertEqual(select("#p a:nth-child(3)")[0], getById("link_2"), "nth-child");
+			this.assertEquivalent(select("#list > li:nth-child(n+2)"), getById("item_2", "item_3"));
+			this.assertEquivalent(select("#list > li:nth-child(-n+2)"), getById("item_1", "item_2"));
 		},
 		"E:nth-of-type(n)": function(){
-			this.assertEqual(select('#p a:nth-of-type(2)')[0], getById('link_2'), 'nth-of-type');
-			this.assertEqual(select('#p a:nth-of-type(1)')[0], getById('link_1'), 'nth-of-type');
+			this.assertEqual(select("#p a:nth-of-type(2)")[0], getById("link_2"), "nth-of-type");
+			this.assertEqual(select("#p a:nth-of-type(1)")[0], getById("link_1"), "nth-of-type");
 		},
 		"E:nth-last-of-type(n)": function(){
-			this.assertEqual(select('#p a:nth-last-of-type(1)')[0], getById('link_2'), 'nth-last-of-type');
+			this.assertEqual(select("#p a:nth-last-of-type(1)")[0], getById("link_2"), "nth-last-of-type");
 		},
 		"E:first-of-type": function(){
-			this.assertEqual(select('#p a:first-of-type')[0], getById('link_1'), 'first-of-type');
+			this.assertEqual(select("#p a:first-of-type")[0], getById("link_1"), "first-of-type");
 		},
 		"E:last-of-type": function(){
-			this.assertEqual(select('#p a:last-of-type')[0], getById('link_2'), 'last-of-type');
+			this.assertEqual(select("#p a:last-of-type")[0], getById("link_2"), "last-of-type");
 		},
 		"E:only-child": function(){
-			this.assertEqual(select('#level1 *:only-child')[0], getById('level_only_child'));
+			this.assertEqual(select("#level1 *:only-child")[0], getById("level_only_child"));
 			//Shouldn't return anything
-			this.assertEquivalent(select('#level1>*:only-child'), []);
-			this.assertEquivalent(select('#level1:only-child'), []);
-			this.assertEquivalent(select('#level2_2 :only-child:not(:last-child)'), []);
-			this.assertEquivalent(select('#level2_2 :only-child:not(:first-child)'), []);
+			this.assertEquivalent(select("#level1>*:only-child"), []);
+			this.assertEquivalent(select("#level1:only-child"), []);
+			this.assertEquivalent(select("#level2_2 :only-child:not(:last-child)"), []);
+			this.assertEquivalent(select("#level2_2 :only-child:not(:first-child)"), []);
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 *:only-child');
+						select("#level1 *:only-child");
 					}, 1000);
 				}, 500);
 			}
 		},
 		"E:empty": function(){
-			getById('level3_1').children = [];
+			getById("level3_1").children = [];
 			if(document.createEvent){
-				this.assertEquivalent(select('#level1 *:empty'), getById('level3_1', 'level3_2', 'level2_3'), '#level1 *:empty');
-				this.assertEquivalent(select('#level_only_child:empty'), [], 'newlines count as content!');
-			}else{
-				this.assertEqual(select('#level3_1:empty')[0], getById('level3_1'), 'IE forced empty content!');
+				this.assertEquivalent(select("#level1 *:empty"), getById("level3_1", "level3_2", "level2_3"), "#level1 *:empty");
+				this.assertEquivalent(select("#level_only_child:empty"), [], "newlines count as content!");
+			} else {
+				this.assertEqual(select("#level3_1:empty")[0], getById("level3_1"), "IE forced empty content!");
 				//this.skip("IE forced empty content!");
 			}
 			//Shouldn't return anything
-			this.assertEquivalent(select('span:empty > *'), []);
+			this.assertEquivalent(select("span:empty > *"), []);
 		}
 	});
 
 	runner.addTests(null, {
 		"E:not(s)": function(){
 			//Negation pseudo-class
-			this.assertEquivalent(select('a:not([href="#"])'), []);
-			this.assertEquivalent(select('div.brothers:not(.brothers)'), []);
-			this.assertEquivalent(select('a[class~=external]:not([href="#"])'), [], 'a[class~=external][href!="#"]');
-			this.assertEqual(select('#p a:not(:first-of-type)')[0], getById('link_2'), 'first-of-type');
-			this.assertEqual(select('#p a:not(:last-of-type)')[0], getById('link_1'), 'last-of-type');
-			this.assertEqual(select('#p a:not(:nth-of-type(1))')[0], getById('link_2'), 'nth-of-type');
-			this.assertEqual(select('#p a:not(:nth-last-of-type(1))')[0], getById('link_1'), 'nth-last-of-type');
-			this.assertEqual(select('#p a:not([rel~=nofollow])')[0], getById('link_2'), 'attribute 1');
-			this.assertEqual(select('#p a:not([rel^=external])')[0], getById('link_2'), 'attribute 2');
-			this.assertEqual(select('#p a:not([rel$=nofollow])')[0], getById('link_2'), 'attribute 3');
-			this.assertEqual(select('#p a:not([rel$="nofollow"]) > em')[0], getById('em'), 'attribute 4');
-			this.assertEqual(select('#list li:not(#item_1):not(#item_3)')[0], getById('item_2'), 'adjacent :not clauses');
-			this.assertEqual(select('#grandfather > div:not(#uncle) #son')[0], getById('son'));
-			this.assertEqual(select('#p a:not([rel$="nofollow"]) em')[0], getById('em'), 'attribute 4 + all descendants');
-			this.assertEqual(select('#p a:not([rel$="nofollow"])>em')[0], getById('em'), 'attribute 4 (without whitespace)');
+			this.assertEquivalent(select("a:not([href=\"#\"])"), []);
+			this.assertEquivalent(select("div.brothers:not(.brothers)"), []);
+			this.assertEquivalent(select("a[class~=external]:not([href=\"#\"])"), [], "a[class~=external][href!=\"#\"]");
+			this.assertEqual(select("#p a:not(:first-of-type)")[0], getById("link_2"), "first-of-type");
+			this.assertEqual(select("#p a:not(:last-of-type)")[0], getById("link_1"), "last-of-type");
+			this.assertEqual(select("#p a:not(:nth-of-type(1))")[0], getById("link_2"), "nth-of-type");
+			this.assertEqual(select("#p a:not(:nth-last-of-type(1))")[0], getById("link_1"), "nth-last-of-type");
+			this.assertEqual(select("#p a:not([rel~=nofollow])")[0], getById("link_2"), "attribute 1");
+			this.assertEqual(select("#p a:not([rel^=external])")[0], getById("link_2"), "attribute 2");
+			this.assertEqual(select("#p a:not([rel$=nofollow])")[0], getById("link_2"), "attribute 3");
+			this.assertEqual(select("#p a:not([rel$=\"nofollow\"]) > em")[0], getById("em"), "attribute 4");
+			this.assertEqual(select("#list li:not(#item_1):not(#item_3)")[0], getById("item_2"), "adjacent :not clauses");
+			this.assertEqual(select("#grandfather > div:not(#uncle) #son")[0], getById("son"));
+			this.assertEqual(select("#p a:not([rel$=\"nofollow\"]) em")[0], getById("em"), "attribute 4 + all descendants");
+			this.assertEqual(select("#p a:not([rel$=\"nofollow\"])>em")[0], getById("em"), "attribute 4 (without whitespace)");
 		}
 	});
 
 	runner.addGroup("UI element states pseudo-classes").addTests(null, {
 		"E:disabled": function(){
-			this.assertEqual(select('#troubleForm > p > *:disabled')[0], getById('disabled_text_field'));
+			this.assertEqual(select("#troubleForm > p > *:disabled")[0], getById("disabled_text_field"));
 		},
 		"E:checked": function(){
-			this.assertEquivalent(select('#troubleForm *:checked'), getById('checked_box', 'checked_radio'));
+			this.assertEquivalent(select("#troubleForm *:checked"), getById("checked_box", "checked_radio"));
 		}
 	});
 
 	runner.addGroup("Combinators").addTests(null, {
 		"E F": function(){
 			//Descendant
-			this.assertEquivalent(select('#fixtures a *'), getById('em2', 'em', 'span'));
-			this.assertEqual(select('div#fixtures p')[0], getById("p"));
+			this.assertEquivalent(select("#fixtures a *"), getById("em2", "em", "span"));
+			this.assertEqual(select("div#fixtures p")[0], getById("p"));
 		},
 		"E + F": function(){
 			//Adjacent sibling
-			this.assertEqual(select('div.brothers + div.brothers')[0], getById("uncle"));
-			this.assertEqual(select('div.brothers + div')[0], getById('uncle'));
-			this.assertEqual(select('#level2_1+span')[0], getById('level2_2'));
-			this.assertEqual(select('#level2_1 + span')[0], getById('level2_2'));
-			this.assertEqual(select('#level2_1 + *')[0], getById('level2_2'));
-			this.assertEquivalent(select('#level2_2 + span'), []);
-			this.assertEqual(select('#level3_1 + span')[0], getById('level3_2'));
-			this.assertEqual(select('#level3_1 + *')[0], getById('level3_2'));
-			this.assertEquivalent(select('#level3_2 + *'), []);
-			this.assertEquivalent(select('#level3_1 + em'), []);
+			this.assertEqual(select("div.brothers + div.brothers")[0], getById("uncle"));
+			this.assertEqual(select("div.brothers + div")[0], getById("uncle"));
+			this.assertEqual(select("#level2_1+span")[0], getById("level2_2"));
+			this.assertEqual(select("#level2_1 + span")[0], getById("level2_2"));
+			this.assertEqual(select("#level2_1 + *")[0], getById("level2_2"));
+			this.assertEquivalent(select("#level2_2 + span"), []);
+			this.assertEqual(select("#level3_1 + span")[0], getById("level3_2"));
+			this.assertEqual(select("#level3_1 + *")[0], getById("level3_2"));
+			this.assertEquivalent(select("#level3_2 + *"), []);
+			this.assertEquivalent(select("#level3_1 + em"), []);
+
+			this.assertEqual(select("+ div.brothers", select("div.brothers"))[0], getById("uncle"));
+			this.assertEqual(select("+ div", select("div.brothers"))[0], getById("uncle"));
+			this.assertEqual(select("+span", select("#level2_1"))[0], getById("level2_2"));
+			this.assertEqual(select("+ span", select("#level2_1"))[0], getById("level2_2"));
+			this.assertEqual(select("+ *", select("#level2_1"))[0], getById("level2_2"));
+			this.assertEquivalent(select("+ span", select("#level2_2")), []);
+			this.assertEqual(select("+ span", select("#level3_1"))[0], getById("level3_2"));
+			this.assertEqual(select("+ *", select("#level3_1"))[0], getById("level3_2"));
+			this.assertEquivalent(select("+ *", select("#level3_2")), []);
+			this.assertEquivalent(select("+ em", select("#level3_1")), []);
+
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level3_1 + span');
+						select("#level3_1 + span");
 					}, 1000);
 				}, 500);
 			}
 		},
 		"E > F": function(){
 			//Child
-			this.assertEquivalent(select('p.first > a'), getById('link_1', 'link_2'));
-			this.assertEquivalent(select('div#grandfather > div'), getById('father', 'uncle'));
-			this.assertEquivalent(select('#level1>span'), getById('level2_1', 'level2_2'));
-			this.assertEquivalent(select('#level1 > span'), getById('level2_1', 'level2_2'));
-			this.assertEquivalent(select('#level2_1 > *'), getById('level3_1', 'level3_2'));
-			this.assertEquivalent(select('div > #nonexistent'), []);
+			this.assertEquivalent(select("p.first > a"), getById("link_1", "link_2"));
+			this.assertEquivalent(select("div#grandfather > div"), getById("father", "uncle"));
+			this.assertEquivalent(select("#level1>span"), getById("level2_1", "level2_2"));
+			this.assertEquivalent(select("#level1 > span"), getById("level2_1", "level2_2"));
+			this.assertEquivalent(select("#level2_1 > *"), getById("level3_1", "level3_2"));
+			this.assertEquivalent(select("div > #nonexistent"), []);
+
+			this.assertEquivalent(select("> a", select("p.first")), getById("link_1", "link_2"));
+			this.assertEquivalent(select("> div", select("div#grandfather")), getById("father", "uncle"));
+			this.assertEquivalent(select(">span", select("#level1")), getById("level2_1", "level2_2"));
+			this.assertEquivalent(select("> span", select("#level1")), getById("level2_1", "level2_2"));
+			this.assertEquivalent(select("> *", select("#level2_1")), getById("level3_1", "level3_2"));
+			this.assertEquivalent(select("> #nonexistent", select("div")), []);
+
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level1 > span');
+						select("#level1 > span");
 					}, 1000);
 				}, 500);
 			}
 		},
 		"E ~ F": function(){
 			//General sibling
-			this.assertEqual(select('h1 ~ ul')[0], getById('list'));
-			this.assertEquivalent(select('#level2_2 ~ span'), []);
-			this.assertEquivalent(select('#level3_2 ~ *'), []);
-			this.assertEquivalent(select('#level3_1 ~ em'), []);
-			this.assertEquivalent(select('div ~ #level3_2'), []);
-			this.assertEquivalent(select('div ~ #level2_3'), []);
-			this.assertEqual(select('#level2_1 ~ span')[0], getById('level2_2'));
-			this.assertEquivalent(select('#level2_1 ~ *'), getById('level2_2', 'level2_3'));
-			this.assertEqual(select('#level3_1 ~ #level3_2')[0], getById('level3_2'));
-			this.assertEqual(select('span ~ #level3_2')[0], getById('level3_2'));
+			this.assertEqual(select("h1 ~ ul")[0], getById("list"));
+			this.assertEquivalent(select("#level2_2 ~ span"), []);
+			this.assertEquivalent(select("#level3_2 ~ *"), []);
+			this.assertEquivalent(select("#level3_1 ~ em"), []);
+			this.assertEquivalent(select("div ~ #level3_2"), []);
+			this.assertEquivalent(select("div ~ #level2_3"), []);
+			this.assertEqual(select("#level2_1 ~ span")[0], getById("level2_2"));
+			this.assertEquivalent(select("#level2_1 ~ *"), getById("level2_2", "level2_3"));
+			this.assertEqual(select("#level3_1 ~ #level3_2")[0], getById("level3_2"));
+			this.assertEqual(select("span ~ #level3_2")[0], getById("level3_2"));
+
+			this.assertEqual(select("~ ul", select("h1"))[0], getById("list"));
+			this.assertEquivalent(select("~ span", select("#level2_2")), []);
+			this.assertEquivalent(select("~ *", select("#level3_2")), []);
+			this.assertEquivalent(select("~ em", select("#level3_1")), []);
+			this.assertEquivalent(select("~ #level3_2", select("div")), []);
+			this.assertEquivalent(select("~ #level2_3", select("div")), []);
+			this.assertEqual(select("~ span", select("#level2_1"))[0], getById("level2_2"));
+			this.assertEquivalent(select("~ *", select("#level2_1")), getById("level2_2", "level2_3"));
+			this.assertEqual(select("~ #level3_2", select("#level3_1"))[0], getById("level3_2"));
+			this.assertEqual(select("~ #level3_2", select("span"))[0], getById("level3_2"));
+
 			if(RUN_BENCHMARKS){
 				this.wait(function(){
 					this.benchmark(function(){
-						select('#level2_1 ~ span');
+						select("#level2_1 ~ span");
 					}, 1000);
 				}, 500);
 			}
@@ -417,9 +449,9 @@ var RUN_BENCHMARKS = false;
 
 	runner.addTests(null, {
 		"NW.Dom.match": function(){
-			var element = getById('dupL1');
+			var element = getById("dupL1");
 			//Assertions
-			this.assert(match(element, 'span'));
+			this.assert(match(element, "span"));
 			this.assert(match(element, "span#dupL1"));
 			this.assert(match(element, "div > span"), "child combinator");
 			this.assert(match(element, "#dupContainer span"), "descendant combinator");
@@ -435,33 +467,33 @@ var RUN_BENCHMARKS = false;
 			this.refute(match(element, "span > span"), "different parent");
 			this.refute(match(element, "span:nth-child(5)"), "different pseudoclass");
 			//Misc.
-			this.refute(match(getById('link_2'), 'a[rel^=external]'));
-			this.assert(match(getById('link_1'), 'a[rel^=external]'));
-			this.assert(match(getById('link_1'), 'a[rel^="external"]'));
-			this.assert(match(getById('link_1'), "a[rel^='external']"));
+			this.refute(match(getById("link_2"), "a[rel^=external]"));
+			this.assert(match(getById("link_1"), "a[rel^=external]"));
+			this.assert(match(getById("link_1"), "a[rel^=\"external\"]"));
+			this.assert(match(getById("link_1"), "a[rel^='external']"));
 		},
 		"Equivalent Selectors": function(){
-			this.assertEquivalent(select('div.brothers'), select('div[class~=brothers]'));
-			this.assertEquivalent(select('div.brothers'), select('div[class~=brothers].brothers'));
-			this.assertEquivalent(select('div:not(.brothers)'), select('div:not([class~=brothers])'));
-			this.assertEquivalent(select('li ~ li'), select('li:not(:first-child)'));
-			this.assertEquivalent(select('ul > li'), select('ul > li:nth-child(n)'));
-			this.assertEquivalent(select('ul > li:nth-child(even)'), select('ul > li:nth-child(2n)'));
-			this.assertEquivalent(select('ul > li:nth-child(odd)'), select('ul > li:nth-child(2n+1)'));
-			this.assertEquivalent(select('ul > li:first-child'), select('ul > li:nth-child(1)'));
-			this.assertEquivalent(select('ul > li:last-child'), select('ul > li:nth-last-child(1)'));
+			this.assertEquivalent(select("div.brothers"), select("div[class~=brothers]"));
+			this.assertEquivalent(select("div.brothers"), select("div[class~=brothers].brothers"));
+			this.assertEquivalent(select("div:not(.brothers)"), select("div:not([class~=brothers])"));
+			this.assertEquivalent(select("li ~ li"), select("li:not(:first-child)"));
+			this.assertEquivalent(select("ul > li"), select("ul > li:nth-child(n)"));
+			this.assertEquivalent(select("ul > li:nth-child(even)"), select("ul > li:nth-child(2n)"));
+			this.assertEquivalent(select("ul > li:nth-child(odd)"), select("ul > li:nth-child(2n+1)"));
+			this.assertEquivalent(select("ul > li:first-child"), select("ul > li:nth-child(1)"));
+			this.assertEquivalent(select("ul > li:last-child"), select("ul > li:nth-last-child(1)"));
 			/* Opera 10 does not accept values > 128 as a parameter to :nth-child
 			See <http://operawiki.info/ArtificialLimits> */
-			this.assertEquivalent(select('ul > li:nth-child(n-128)'), select('ul > li'));
-			this.assertEquivalent(select('ul>li'), select('ul > li'));
-			this.assertEquivalent(select('#p a:not([rel$="nofollow"])>em'), select('#p a:not([rel$="nofollow"]) > em'));
+			this.assertEquivalent(select("ul > li:nth-child(n-128)"), select("ul > li"));
+			this.assertEquivalent(select("ul>li"), select("ul > li"));
+			this.assertEquivalent(select("#p a:not([rel$=\"nofollow\"])>em"), select("#p a:not([rel$=\"nofollow\"]) > em"));
 		},
 		"Multiple Selectors": function(){
 			//The next two assertions should return document-ordered lists of matching elements --Diego Perini
 			//  this.assertEquivalent(select('#list, .first,*[xml:lang="es-us"] , #troubleForm'), getById('p', 'link_1', 'list', 'item_1', 'item_3', 'troubleForm'));
 			//  this.assertEquivalent(select('#list, .first, *[xml:lang="es-us"], #troubleForm'), getById('p', 'link_1', 'list', 'item_1', 'item_3', 'troubleForm'));
-			this.assertEquivalent(select('form[title*="commas,"], input[value="#commaOne,#commaTwo"]'), getById('commaParent', 'commaChild'));
-			this.assertEquivalent(select('form[title*="commas,"], input[value="#commaOne,#commaTwo"]'), getById('commaParent', 'commaChild'));
+			this.assertEquivalent(select("form[title*=\"commas,\"], input[value=\"#commaOne,#commaTwo\"]"), getById("commaParent", "commaChild"));
+			this.assertEquivalent(select("form[title*=\"commas,\"], input[value=\"#commaOne,#commaTwo\"]"), getById("commaParent", "commaChild"));
 		}
 	});
 }(runner));
diff --git a/test/qwery/index.js b/test/qwery/index.js
index 3ac3500..db70a3b 100644
--- a/test/qwery/index.js
+++ b/test/qwery/index.js
@@ -1,7 +1,7 @@
 "use strict";
 
 var expect = require("expect.js"),
-    DomUtils = require("htmlparser2").DomUtils,
+	DomUtils = require("htmlparser2").DomUtils,
 	helper = require("../tools/helper.js"),
 	path = require("path"),
 	document = helper.getDocument(path.join(__dirname, "index.html")),
@@ -18,41 +18,41 @@ CSSselect.pseudos.target = function(elem){
 	The following is taken from https://github.com/ded/qwery/blob/master/tests/tests.js
 */
 
-CSSselect.pseudos.humanoid = function(e) { return CSSselect.is(e, 'li:contains(human)') || CSSselect.is(e, 'ol:contains(human)'); };
+CSSselect.pseudos.humanoid = function(e){ return CSSselect.is(e, "li:contains(human)") || CSSselect.is(e, "ol:contains(human)"); };
 
 var frag = helper.getDOM(
-	'<root><div class="d i v">' +
-		'<p id="oooo"><em></em><em id="emem"></em></p>' +
-	'</div>' +
-	'<p id="sep">' +
-		'<div class="a"><span></span></div>' +
-	'</p></root>'
+	"<root><div class=\"d i v\">" +
+		"<p id=\"oooo\"><em></em><em id=\"emem\"></em></p>" +
+	"</div>" +
+	"<p id=\"sep\">" +
+		"<div class=\"a\"><span></span></div>" +
+	"</p></root>"
 );
 
 var doc = helper.getDOM(
-	'<root><div id="hsoob">' +
-		'<div class="a b">' +
-			'<div class="d e sib" test="fg" id="booshTest"><p><span id="spanny"></span></p></div>' +
-			'<em nopass="copyrighters" rel="copyright booshrs" test="f g" class="sib"></em>' +
-			'<span class="h i a sib"></span>' +
-		'</div>' +
-		'<p class="odd"></p>' +
-	'</div>' +
-	'<div id="lonelyHsoob"></div></root>'
+	"<root><div id=\"hsoob\">" +
+		"<div class=\"a b\">" +
+			"<div class=\"d e sib\" test=\"fg\" id=\"booshTest\"><p><span id=\"spanny\"></span></p></div>" +
+			"<em nopass=\"copyrighters\" rel=\"copyright booshrs\" test=\"f g\" class=\"sib\"></em>" +
+			"<span class=\"h i a sib\"></span>" +
+		"</div>" +
+		"<p class=\"odd\"></p>" +
+	"</div>" +
+	"<div id=\"lonelyHsoob\"></div></root>"
 );
 
-var el = DomUtils.getElementById('attr-child-boosh', document);
+var el = DomUtils.getElementById("attr-child-boosh", document);
 
-var pseudos = DomUtils.getElementById('pseudos', document).children.filter(DomUtils.isTag);
+var pseudos = DomUtils.getElementById("pseudos", document).children.filter(DomUtils.isTag);
 
 module.exports = {
 
-'Contexts': {
+	"Contexts": {
 
-	'should be able to pass optional context': function () {
-		expect(CSSselect('.a', document)).to.have.length(3); //no context found 3 elements (.a)
-		expect(CSSselect('.a', CSSselect('#boosh', document))).to.have.length(2); //context found 2 elements (#boosh .a)
-	},
+		"should be able to pass optional context": function (){
+			expect(CSSselect(".a", document)).to.have.length(3); //no context found 3 elements (.a)
+			expect(CSSselect(".a", CSSselect("#boosh", document))).to.have.length(2); //context found 2 elements (#boosh .a)
+		},
 
 /*
 	'should be able to pass string as context': function() {
@@ -72,171 +72,171 @@ module.exports = {
 		expect(CSSselect('.b', CSSselect('#boosh .b', document))).to.be.empty(); //context found 0 elements(.b, #boosh .b)
 	},
 */
-	'should not return duplicates from combinators': function () {
-		expect(CSSselect('#boosh,#boosh', document)).to.have.length(1); //two booshes dont make a thing go right
-		expect(CSSselect('#boosh,.apples,#boosh', document)).to.have.length(1); //two booshes and an apple dont make a thing go right
-	},
-
-	'byId sub-queries within context': function() {
-		expect(CSSselect('#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found "#id #id"
-		expect(CSSselect('.a.b #booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ".class.class #id"
-		expect(CSSselect('.a>#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ".class>#id"
-		expect(CSSselect('>.a>#booshTest', CSSselect('#boosh', document))).to.have.length(1); //found ">.class>#id"
-		expect(CSSselect('#boosh', CSSselect('#booshTest', document)).length).to.not.be.ok(); //shouldn't find #boosh (ancestor) within #booshTest (descendent)
-		expect(CSSselect('#boosh', CSSselect('#lonelyBoosh', document)).length).to.not.be.ok(); //shouldn't find #boosh within #lonelyBoosh (unrelated)
-	}
-},
-
-'CSS 1': {
-	'get element by id': function () {
-		var result = CSSselect('#boosh', document);
-		expect(result[0]).to.be.ok(); //found element with id=boosh
-		expect(CSSselect('h1', document)[0]).to.be.ok(); //found 1 h1
-	},
-
-	'byId sub-queries': function() {
-		expect(CSSselect('#boosh #booshTest', document)).to.have.length(1); //found "#id #id"
-		expect(CSSselect('.a.b #booshTest', document)).to.have.length(1); //found ".class.class #id"
-		expect(CSSselect('#boosh>.a>#booshTest', document)).to.have.length(1); //found "#id>.class>#id"
-		expect(CSSselect('.a>#booshTest', document)).to.have.length(1); //found ".class>#id"
-	},
-
-	'get elements by class': function () {
-		expect(CSSselect('#boosh .a', document)).to.have.length(2); //found two elements
-		expect(CSSselect('#boosh div.a', document)[0]).to.be.ok(); //found one element
-		expect(CSSselect('#boosh div', document)).to.have.length(2); //found two {div} elements
-		expect(CSSselect('#boosh span', document)[0]).to.be.ok(); //found one {span} element
-		expect(CSSselect('#boosh div div', document)[0]).to.be.ok(); //found a single div
-		expect(CSSselect('a.odd', document)).to.have.length(1); //found single a
-	},
-
-	'combos': function () {
-		expect(CSSselect('#boosh div,#boosh span', document)).to.have.length(3); //found 2 divs and 1 span
-	},
-
-	'class with dashes': function() {
-		expect(CSSselect('.class-with-dashes', document)).to.have.length(1); //found something
-	},
-
-	'should ignore comment nodes': function() {
-		expect(CSSselect('#boosh *', document)).to.have.length(4); //found only 4 elements under #boosh
+		"should not return duplicates from combinators": function (){
+			expect(CSSselect("#boosh,#boosh", document)).to.have.length(1); //two booshes dont make a thing go right
+			expect(CSSselect("#boosh,.apples,#boosh", document)).to.have.length(1); //two booshes and an apple dont make a thing go right
+		},
+
+		"byId sub-queries within context": function(){
+			expect(CSSselect("#booshTest", CSSselect("#boosh", document))).to.have.length(1); //found "#id #id"
+			expect(CSSselect(".a.b #booshTest", CSSselect("#boosh", document))).to.have.length(1); //found ".class.class #id"
+			expect(CSSselect(".a>#booshTest", CSSselect("#boosh", document))).to.have.length(1); //found ".class>#id"
+			expect(CSSselect(">.a>#booshTest", CSSselect("#boosh", document))).to.have.length(1); //found ">.class>#id"
+			expect(CSSselect("#boosh", CSSselect("#booshTest", document)).length).to.not.be.ok(); //shouldn't find #boosh (ancestor) within #booshTest (descendent)
+			expect(CSSselect("#boosh", CSSselect("#lonelyBoosh", document)).length).to.not.be.ok(); //shouldn't find #boosh within #lonelyBoosh (unrelated)
+		}
 	},
 
-	'deep messy relationships': function() {
+	"CSS 1": {
+		"get element by id": function (){
+			var result = CSSselect("#boosh", document);
+			expect(result[0]).to.be.ok(); //found element with id=boosh
+			expect(CSSselect("h1", document)[0]).to.be.ok(); //found 1 h1
+		},
+
+		"byId sub-queries": function(){
+			expect(CSSselect("#boosh #booshTest", document)).to.have.length(1); //found "#id #id"
+			expect(CSSselect(".a.b #booshTest", document)).to.have.length(1); //found ".class.class #id"
+			expect(CSSselect("#boosh>.a>#booshTest", document)).to.have.length(1); //found "#id>.class>#id"
+			expect(CSSselect(".a>#booshTest", document)).to.have.length(1); //found ".class>#id"
+		},
+
+		"get elements by class": function (){
+			expect(CSSselect("#boosh .a", document)).to.have.length(2); //found two elements
+			expect(CSSselect("#boosh div.a", document)[0]).to.be.ok(); //found one element
+			expect(CSSselect("#boosh div", document)).to.have.length(2); //found two {div} elements
+			expect(CSSselect("#boosh span", document)[0]).to.be.ok(); //found one {span} element
+			expect(CSSselect("#boosh div div", document)[0]).to.be.ok(); //found a single div
+			expect(CSSselect("a.odd", document)).to.have.length(1); //found single a
+		},
+
+		"combos": function (){
+			expect(CSSselect("#boosh div,#boosh span", document)).to.have.length(3); //found 2 divs and 1 span
+		},
+
+		"class with dashes": function(){
+			expect(CSSselect(".class-with-dashes", document)).to.have.length(1); //found something
+		},
+
+		"should ignore comment nodes": function(){
+			expect(CSSselect("#boosh *", document)).to.have.length(4); //found only 4 elements under #boosh
+		},
+
+		"deep messy relationships": function(){
 		// these are mostly characterised by a combination of tight relationships and loose relationships
 		// on the right side of the query it's easy to find matches but they tighten up quickly as you
 		// go to the left
 		// they are useful for making sure the dom crawler doesn't stop short or over-extend as it works
 		// up the tree the crawl needs to be comprehensive
-		expect(CSSselect('div#fixtures > div a', document)).to.have.length(5); //found four results for "div#fixtures > div a"
-		expect(CSSselect('.direct-descend > .direct-descend .lvl2', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend .lvl2"
-		expect(CSSselect('.direct-descend > .direct-descend div', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div"
-		expect(CSSselect('.direct-descend > .direct-descend div', document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div"
-		expect(CSSselect('div#fixtures div ~ a div', document)).to.be.empty(); //found no results for odd query
-		expect(CSSselect('.direct-descend > .direct-descend > .direct-descend ~ .lvl2', document)).to.be.empty(); //found no results for another odd query
-	}
-},
-
-'CSS 2': {
-
-	'get elements by attribute': function () {
-		var wanted = CSSselect('#boosh div[test]', document)[0];
-		var expected = DomUtils.getElementById('booshTest', document);
-		expect(wanted).to.be(expected); //found attribute
-		expect(CSSselect('#boosh div[test=fg]', document)[0]).to.be(expected); //found attribute with value
-		expect(CSSselect('em[rel~="copyright"]', document)).to.have.length(1); //found em[rel~="copyright"]
-		expect(CSSselect('em[nopass~="copyright"]', document)).to.be.empty(); //found em[nopass~="copyright"]
-	},
-
-	'should not throw error by attribute selector': function () {
-		expect(CSSselect('[foo^="bar"]', document)).to.have.length(1); //found 1 element
+			expect(CSSselect("div#fixtures > div a", document)).to.have.length(5); //found four results for "div#fixtures > div a"
+			expect(CSSselect(".direct-descend > .direct-descend .lvl2", document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend .lvl2"
+			expect(CSSselect(".direct-descend > .direct-descend div", document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div"
+			expect(CSSselect(".direct-descend > .direct-descend div", document)).to.have.length(1); //found one result for ".direct-descend > .direct-descend div"
+			expect(CSSselect("div#fixtures div ~ a div", document)).to.be.empty(); //found no results for odd query
+			expect(CSSselect(".direct-descend > .direct-descend > .direct-descend ~ .lvl2", document)).to.be.empty(); //found no results for another odd query
+		}
 	},
 
-	'crazy town': function () {
-		var el = DomUtils.getElementById('attr-test3', document);
-		expect(CSSselect('div#attr-test3.found.you[title="whatup duders"]', document)[0]).to.be(el); //found the right element
-	}
+	"CSS 2": {
 
-},
+		"get elements by attribute": function (){
+			var wanted = CSSselect("#boosh div[test]", document)[0];
+			var expected = DomUtils.getElementById("booshTest", document);
+			expect(wanted).to.be(expected); //found attribute
+			expect(CSSselect("#boosh div[test=fg]", document)[0]).to.be(expected); //found attribute with value
+			expect(CSSselect("em[rel~=\"copyright\"]", document)).to.have.length(1); //found em[rel~="copyright"]
+			expect(CSSselect("em[nopass~=\"copyright\"]", document)).to.be.empty(); //found em[nopass~="copyright"]
+		},
 
-'attribute selectors': {
+		"should not throw error by attribute selector": function (){
+			expect(CSSselect("[foo^=\"bar\"]", document)).to.have.length(1); //found 1 element
+		},
 
-	/* CSS 2 SPEC */
+		"crazy town": function (){
+			var el = DomUtils.getElementById("attr-test3", document);
+			expect(CSSselect("div#attr-test3.found.you[title=\"whatup duders\"]", document)[0]).to.be(el); //found the right element
+		}
 
-	'[attr]': function () {
-		var expected = DomUtils.getElementById('attr-test-1', document);
-		expect(CSSselect('#attributes div[unique-test]', document)[0]).to.be(expected); //found attribute with [attr]
 	},
 
-	'[attr=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-2', document);
-		expect(CSSselect('#attributes div[test="two-foo"]', document)[0]).to.be(expected); //found attribute with =
-		expect(CSSselect("#attributes div[test='two-foo']", document)[0]).to.be(expected); //found attribute with =
-		expect(CSSselect('#attributes div[test=two-foo]', document)[0]).to.be(expected); //found attribute with =
-	},
+	"attribute selectors": {
 
-	'[attr~=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-3', document);
-		expect(CSSselect('#attributes div[test~=three]', document)[0]).to.be(expected); //found attribute with ~=
-	},
-
-	'[attr|=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-2', document);
-		expect(CSSselect('#attributes div[test|="two-foo"]', document)[0]).to.be(expected); //found attribute with |=
-		expect(CSSselect('#attributes div[test|=two]', document)[0]).to.be(expected); //found attribute with |=
-	},
+	/* CSS 2 SPEC */
 
-	'[href=#x] special case': function () {
-		var expected = DomUtils.getElementById('attr-test-4', document);
-		expect(CSSselect('#attributes a[href="#aname"]', document)[0]).to.be(expected); //found attribute with href=#x
-	},
+		"[attr]": function (){
+			var expected = DomUtils.getElementById("attr-test-1", document);
+			expect(CSSselect("#attributes div[unique-test]", document)[0]).to.be(expected); //found attribute with [attr]
+		},
+
+		"[attr=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-2", document);
+			expect(CSSselect("#attributes div[test=\"two-foo\"]", document)[0]).to.be(expected); //found attribute with =
+			expect(CSSselect("#attributes div[test='two-foo']", document)[0]).to.be(expected); //found attribute with =
+			expect(CSSselect("#attributes div[test=two-foo]", document)[0]).to.be(expected); //found attribute with =
+		},
+
+		"[attr~=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-3", document);
+			expect(CSSselect("#attributes div[test~=three]", document)[0]).to.be(expected); //found attribute with ~=
+		},
+
+		"[attr|=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-2", document);
+			expect(CSSselect("#attributes div[test|=\"two-foo\"]", document)[0]).to.be(expected); //found attribute with |=
+			expect(CSSselect("#attributes div[test|=two]", document)[0]).to.be(expected); //found attribute with |=
+		},
+
+		"[href=#x] special case": function (){
+			var expected = DomUtils.getElementById("attr-test-4", document);
+			expect(CSSselect("#attributes a[href=\"#aname\"]", document)[0]).to.be(expected); //found attribute with href=#x
+		},
 
 	/* CSS 3 SPEC */
 
-	'[attr^=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-2', document);
-		expect(CSSselect('#attributes div[test^=two]', document)[0]).to.be(expected); //found attribute with ^=
-	},
-
-	'[attr$=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-2', document);
-		expect(CSSselect('#attributes div[test$=foo]', document)[0]).to.be(expected); //found attribute with $=
-	},
-
-	'[attr*=val]': function () {
-		var expected = DomUtils.getElementById('attr-test-3', document);
-		expect(CSSselect('#attributes div[test*=hree]', document)[0]).to.be(expected); //found attribute with *=
-	},
+		"[attr^=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-2", document);
+			expect(CSSselect("#attributes div[test^=two]", document)[0]).to.be(expected); //found attribute with ^=
+		},
+
+		"[attr$=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-2", document);
+			expect(CSSselect("#attributes div[test$=foo]", document)[0]).to.be(expected); //found attribute with $=
+		},
+
+		"[attr*=val]": function (){
+			var expected = DomUtils.getElementById("attr-test-3", document);
+			expect(CSSselect("#attributes div[test*=hree]", document)[0]).to.be(expected); //found attribute with *=
+		},
+
+		"direct descendants": function (){
+			expect(CSSselect("#direct-descend > .direct-descend", document)).to.have.length(2); //found two direct descendents
+			expect(CSSselect("#direct-descend > .direct-descend > .lvl2", document)).to.have.length(3); //found three second-level direct descendents
+		},
+
+		"sibling elements": function (){
+			expect(CSSselect("#sibling-selector ~ .sibling-selector", document)).to.have.length(2); //found two siblings
+			expect(CSSselect("#sibling-selector ~ div.sibling-selector", document)).to.have.length(2); //found two siblings
+			expect(CSSselect("#sibling-selector + div.sibling-selector", document)).to.have.length(1); //found one sibling
+			expect(CSSselect("#sibling-selector + .sibling-selector", document)).to.have.length(1); //found one sibling
+
+			expect(CSSselect(".parent .oldest ~ .sibling", document)).to.have.length(4); //found four younger siblings
+			expect(CSSselect(".parent .middle ~ .sibling", document)).to.have.length(2); //found two younger siblings
+			expect(CSSselect(".parent .middle ~ h4", document)).to.have.length(1); //found next sibling by tag
+			expect(CSSselect(".parent .middle ~ h4.younger", document)).to.have.length(1); //found next sibling by tag and class
+			expect(CSSselect(".parent .middle ~ h3", document)).to.be.empty(); //an element can't be its own sibling
+			expect(CSSselect(".parent .middle ~ h2", document)).to.be.empty(); //didn't find an older sibling
+			expect(CSSselect(".parent .youngest ~ .sibling", document)).to.be.empty(); //found no younger siblings
+
+			expect(CSSselect(".parent .oldest + .sibling", document)).to.have.length(1); //found next sibling
+			expect(CSSselect(".parent .middle + .sibling", document)).to.have.length(1); //found next sibling
+			expect(CSSselect(".parent .middle + h4", document)).to.have.length(1); //found next sibling by tag
+			expect(CSSselect(".parent .middle + h3", document)).to.be.empty(); //an element can't be its own sibling
+			expect(CSSselect(".parent .middle + h2", document)).to.be.empty(); //didn't find an older sibling
+			expect(CSSselect(".parent .youngest + .sibling", document)).to.be.empty(); //found no younger siblings
+		}
 
-	'direct descendants': function () {
-		expect(CSSselect('#direct-descend > .direct-descend', document)).to.have.length(2); //found two direct descendents
-		expect(CSSselect('#direct-descend > .direct-descend > .lvl2', document)).to.have.length(3); //found three second-level direct descendents
 	},
 
-	'sibling elements': function () {
-		expect(CSSselect('#sibling-selector ~ .sibling-selector', document)).to.have.length(2); //found two siblings
-		expect(CSSselect('#sibling-selector ~ div.sibling-selector', document)).to.have.length(2); //found two siblings
-		expect(CSSselect('#sibling-selector + div.sibling-selector', document)).to.have.length(1); //found one sibling
-		expect(CSSselect('#sibling-selector + .sibling-selector', document)).to.have.length(1); //found one sibling
-
-		expect(CSSselect('.parent .oldest ~ .sibling', document)).to.have.length(4); //found four younger siblings
-		expect(CSSselect('.parent .middle ~ .sibling', document)).to.have.length(2); //found two younger siblings
-		expect(CSSselect('.parent .middle ~ h4', document)).to.have.length(1); //found next sibling by tag
-		expect(CSSselect('.parent .middle ~ h4.younger', document)).to.have.length(1); //found next sibling by tag and class
-		expect(CSSselect('.parent .middle ~ h3', document)).to.be.empty(); //an element can't be its own sibling
-		expect(CSSselect('.parent .middle ~ h2', document)).to.be.empty(); //didn't find an older sibling
-		expect(CSSselect('.parent .youngest ~ .sibling', document)).to.be.empty(); //found no younger siblings
-
-		expect(CSSselect('.parent .oldest + .sibling', document)).to.have.length(1); //found next sibling
-		expect(CSSselect('.parent .middle + .sibling', document)).to.have.length(1); //found next sibling
-		expect(CSSselect('.parent .middle + h4', document)).to.have.length(1); //found next sibling by tag
-		expect(CSSselect('.parent .middle + h3', document)).to.be.empty(); //an element can't be its own sibling
-		expect(CSSselect('.parent .middle + h2', document)).to.be.empty(); //didn't find an older sibling
-		expect(CSSselect('.parent .youngest + .sibling', document)).to.be.empty(); //found no younger siblings
-	}
-
-},
-
 /*
 'Uniq': {
 	'duplicates arent found in arrays': function () {
@@ -247,63 +247,61 @@ module.exports = {
 */
 
 
-'element-context queries': {
+	"element-context queries": {
 
-/*
-	'relationship-first queries': function() {
-		expect(CSSselect('> .direct-descend', CSSselect('#direct-descend', document))).to.have.length(2); //found two direct descendents using > first
-		expect(CSSselect('~ .sibling-selector', CSSselect('#sibling-selector', document))).to.have.length(2); //found two siblings with ~ first
-		expect(CSSselect('+ .sibling-selector', CSSselect('#sibling-selector', document))).to.have.length(1); //found one sibling with + first
-		expect(CSSselect('> .tokens a', CSSselect('.idless', document)[0])).to.have.length(1); //found one sibling from a root with no id
-	},
-*/
+		"relationship-first queries": function(){
+			expect(CSSselect("> .direct-descend", CSSselect("#direct-descend", document))).to.have.length(2); //found two direct descendents using > first
+			expect(CSSselect("~ .sibling-selector", CSSselect("#sibling-selector", document))).to.have.length(2); //found two siblings with ~ first
+			expect(CSSselect("+ .sibling-selector", CSSselect("#sibling-selector", document))).to.have.length(1); //found one sibling with + first
+			expect(CSSselect("> .tokens a", CSSselect(".idless", document)[0])).to.have.length(1); //found one sibling from a root with no id
+		},
 
 	// should be able to query on an element that hasn't been inserted into the dom
-	'detached fragments': function() {
-		expect(CSSselect('.a span', frag)).to.have.length(1); //should find child elements of fragment
-		expect(CSSselect('> div p em', frag)).to.have.length(2); //should find child elements of fragment, relationship first
-	},
+		"detached fragments": function(){
+			expect(CSSselect(".a span", frag)).to.have.length(1); //should find child elements of fragment
+			expect(CSSselect("> div p em", frag)).to.have.length(2); //should find child elements of fragment, relationship first
+		},
 
-	'byId sub-queries within detached fragment': function () {
-		expect(CSSselect('#emem', frag)).to.have.length(1); //found "#id" in fragment
-		expect(CSSselect('.d.i #emem', frag)).to.have.length(1); //found ".class.class #id" in fragment
-		expect(CSSselect('.d #oooo #emem', frag)).to.have.length(1); //found ".class #id #id" in fragment
-		expect(CSSselect('> div #oooo', frag)).to.have.length(1); //found "> .class #id" in fragment
-		expect(CSSselect('#oooo', CSSselect('#emem', frag)).length).to.not.be.ok(); //shouldn't find #oooo (ancestor) within #emem (descendent)
-		expect(CSSselect('#sep', CSSselect('#emem', frag)).length).to.not.be.ok(); //shouldn't find #sep within #emem (unrelated)
-	},
+		"byId sub-queries within detached fragment": function (){
+			expect(CSSselect("#emem", frag)).to.have.length(1); //found "#id" in fragment
+			expect(CSSselect(".d.i #emem", frag)).to.have.length(1); //found ".class.class #id" in fragment
+			expect(CSSselect(".d #oooo #emem", frag)).to.have.length(1); //found ".class #id #id" in fragment
+			expect(CSSselect("> div #oooo", frag)).to.have.length(1); //found "> .class #id" in fragment
+			expect(CSSselect("#oooo", CSSselect("#emem", frag)).length).to.not.be.ok(); //shouldn't find #oooo (ancestor) within #emem (descendent)
+			expect(CSSselect("#sep", CSSselect("#emem", frag)).length).to.not.be.ok(); //shouldn't find #sep within #emem (unrelated)
+		},
 
 
-	'exclude self in match': function() {
-		expect(CSSselect('.order-matters', CSSselect('#order-matters', document)[0])).to.have.length(4); //should not include self in element-context queries
-	},
+		"exclude self in match": function(){
+			expect(CSSselect(".order-matters", CSSselect("#order-matters", document)[0])).to.have.length(4); //should not include self in element-context queries
+		},
 
 
 	// because form's have .length
-	'forms can be used as contexts': function() {
-		expect(CSSselect('*', CSSselect('form', document)[0])).to.have.length(3); //found 3 elements under <form>
-	}
-},
+		"forms can be used as contexts": function(){
+			expect(CSSselect("*", CSSselect("form", document)[0])).to.have.length(3); //found 3 elements under <form>
+		}
+	},
 
-'tokenizer': {
+	"tokenizer": {
 
-	'should not get weird tokens': function () {
-		expect(CSSselect('div .tokens[title="one"]', document)[0]).to.be(DomUtils.getElementById('token-one', document)); //found div .tokens[title="one"]
-		expect(CSSselect('div .tokens[title="one two"]', document)[0]).to.be(DomUtils.getElementById('token-two', document)); //found div .tokens[title="one two"]
-		expect(CSSselect('div .tokens[title="one two three #%"]', document)[0]).to.be(DomUtils.getElementById('token-three', document)); //found div .tokens[title="one two three #%"]
-		expect(CSSselect("div .tokens[title='one two three #%'] a", document)[0]).to.be(DomUtils.getElementById('token-four', document)); //found div .tokens[title=\'one two three #%\'] a
-		expect(CSSselect('div .tokens[title="one two three #%"] a[href$=foo] div', document)[0]).to.be(DomUtils.getElementById('token-five', document)); //found div .tokens[title="one two three #%"] a[href=foo] div
-	}
+		"should not get weird tokens": function (){
+			expect(CSSselect("div .tokens[title=\"one\"]", document)[0]).to.be(DomUtils.getElementById("token-one", document)); //found div .tokens[title="one"]
+			expect(CSSselect("div .tokens[title=\"one two\"]", document)[0]).to.be(DomUtils.getElementById("token-two", document)); //found div .tokens[title="one two"]
+			expect(CSSselect("div .tokens[title=\"one two three #%\"]", document)[0]).to.be(DomUtils.getElementById("token-three", document)); //found div .tokens[title="one two three #%"]
+			expect(CSSselect("div .tokens[title='one two three #%'] a", document)[0]).to.be(DomUtils.getElementById("token-four", document)); //found div .tokens[title=\'one two three #%\'] a
+			expect(CSSselect("div .tokens[title=\"one two three #%\"] a[href$=foo] div", document)[0]).to.be(DomUtils.getElementById("token-five", document)); //found div .tokens[title="one two three #%"] a[href=foo] div
+		}
 
-},
+	},
 
-'interesting syntaxes': {
-	'should parse bad selectors': function () {
-		expect(CSSselect('#spaced-tokens    p    em    a', document).length).to.be.ok(); //found element with funny tokens
-	}
-},
+	"interesting syntaxes": {
+		"should parse bad selectors": function (){
+			expect(CSSselect("#spaced-tokens    p    em    a", document).length).to.be.ok(); //found element with funny tokens
+		}
+	},
 
-'order matters': {
+	"order matters": {
 
 	// <div id="order-matters">
 	//   <p class="order-matters"></p>
@@ -312,136 +310,136 @@ module.exports = {
 	//   </a>
 	// </div>
 
-	'the order of elements return matters': function () {
-		function tag(el) {
-			return el.name.toLowerCase();
+		"the order of elements return matters": function (){
+			function tag(el){
+				return el.name.toLowerCase();
+			}
+			var els = CSSselect("#order-matters .order-matters", document);
+			expect(tag(els[0])).to.be("p"); //first element matched is a {p} tag
+			expect(tag(els[1])).to.be("a"); //first element matched is a {a} tag
+			expect(tag(els[2])).to.be("em"); //first element matched is a {em} tag
+			expect(tag(els[3])).to.be("b"); //first element matched is a {b} tag
 		}
-		var els = CSSselect('#order-matters .order-matters', document);
-		expect(tag(els[0])).to.be('p'); //first element matched is a {p} tag
-		expect(tag(els[1])).to.be('a'); //first element matched is a {a} tag
-		expect(tag(els[2])).to.be('em'); //first element matched is a {em} tag
-		expect(tag(els[3])).to.be('b'); //first element matched is a {b} tag
-	}
-
-},
-
-'pseudo-selectors': {
-	':contains': function() {
-		expect(CSSselect('li:contains(humans)', document)).to.have.length(1); //found by "element:contains(text)"
-		expect(CSSselect(':contains(humans)', document)).to.have.length(5); //found by ":contains(text)", including all ancestors
-		// * is an important case, can cause weird errors
-		expect(CSSselect('*:contains(humans)', document)).to.have.length(5); //found by "*:contains(text)", including all ancestors
-		expect(CSSselect('ol:contains(humans)', document)).to.have.length(1); //found by "ancestor:contains(text)"
-	},
-
-	':not': function() {
-		expect(CSSselect('.odd:not(div)', document)).to.have.length(1); //found one .odd :not an <a>
-	},
-
-	':first-child': function () {
-		expect(CSSselect('#pseudos div:first-child', document)[0]).to.be(pseudos[0]); //found first child
-		expect(CSSselect('#pseudos div:first-child', document)).to.have.length(1); //found only 1
-	},
-
-	':last-child': function () {
-		var all = DomUtils.getElementsByTagName('div', pseudos);
-		expect(CSSselect('#pseudos div:last-child', document)[0]).to.be(all[all.length - 1]); //found last child
-		expect(CSSselect('#pseudos div:last-child', document)).to.have.length(1); //found only 1
-	},
 
-	'ol > li[attr="boosh"]:last-child': function () {
-		var expected = DomUtils.getElementById('attr-child-boosh', document);
-		expect(CSSselect('ol > li[attr="boosh"]:last-child', document)).to.have.length(1); //only 1 element found
-		expect(CSSselect('ol > li[attr="boosh"]:last-child', document)[0]).to.be(expected); //found correct element
 	},
 
-	':nth-child(odd|even|x)': function () {
-		var second = DomUtils.getElementsByTagName('div', pseudos)[1];
-		expect(CSSselect('#pseudos :nth-child(odd)', document)).to.have.length(4); //found 4 odd elements
-		expect(CSSselect('#pseudos div:nth-child(odd)', document)).to.have.length(3); //found 3 odd elements with div tag
-		expect(CSSselect('#pseudos div:nth-child(even)', document)).to.have.length(3); //found 3 even elements with div tag
-		expect(CSSselect('#pseudos div:nth-child(2)', document)[0]).to.be(second); //found 2nd nth-child of pseudos
-	},
-
-	':nth-child(expr)': function () {
-		var fifth = DomUtils.getElementsByTagName('a', pseudos)[0];
-		var sixth = DomUtils.getElementsByTagName('div', pseudos)[4];
-
-		expect(CSSselect('#pseudos :nth-child(3n+1)', document)).to.have.length(3); //found 3 elements
-		expect(CSSselect('#pseudos :nth-child(+3n-2)', document)).to.have.length(3); //found 3 elements'
-		expect(CSSselect('#pseudos :nth-child(-n+6)', document)).to.have.length(6); //found 6 elements
-		expect(CSSselect('#pseudos :nth-child(-n+5)', document)).to.have.length(5); //found 5 elements
-		expect(CSSselect('#pseudos :nth-child(3n+2)', document)[1]).to.be(fifth); //second :nth-child(3n+2) is the fifth child
-		expect(CSSselect('#pseudos :nth-child(3n)', document)[1]).to.be(sixth); //second :nth-child(3n) is the sixth child
-	},
-
-	':nth-last-child(odd|even|x)': function () {
-		var second = DomUtils.getElementsByTagName('div', pseudos)[1];
-		expect(CSSselect('#pseudos :nth-last-child(odd)', document)).to.have.length(4); //found 4 odd elements
-		expect(CSSselect('#pseudos div:nth-last-child(odd)', document)).to.have.length(3); //found 3 odd elements with div tag
-		expect(CSSselect('#pseudos div:nth-last-child(even)', document)).to.have.length(3); //found 3 even elements with div tag
-		expect(CSSselect('#pseudos div:nth-last-child(6)', document)[0]).to.be(second); //6th nth-last-child should be 2nd of 7 elements
-	},
-
-	':nth-last-child(expr)': function () {
-		var third = DomUtils.getElementsByTagName('div', pseudos)[2];
-
-		expect(CSSselect('#pseudos :nth-last-child(3n+1)', document)).to.have.length(3); //found 3 elements
-		expect(CSSselect('#pseudos :nth-last-child(3n-2)', document)).to.have.length(3); //found 3 elements
-		expect(CSSselect('#pseudos :nth-last-child(-n+6)', document)).to.have.length(6); //found 6 elements
-		expect(CSSselect('#pseudos :nth-last-child(-n+5)', document)).to.have.length(5); //found 5 elements
-		expect(CSSselect('#pseudos :nth-last-child(3n+2)', document)[0]).to.be(third); //first :nth-last-child(3n+2) is the third child
-	},
-
-	':nth-of-type(expr)': function () {
-		var a = DomUtils.getElementsByTagName('a', pseudos)[0];
-
-		expect(CSSselect('#pseudos div:nth-of-type(3n+1)', document)).to.have.length(2); //found 2 div elements
-		expect(CSSselect('#pseudos a:nth-of-type(3n+1)', document)).to.have.length(1); //found 1 a element
-		expect(CSSselect('#pseudos a:nth-of-type(3n+1)', document)[0]).to.be(a); //found the right a element
-		expect(CSSselect('#pseudos a:nth-of-type(3n)', document)).to.be.empty(); //no matches for every third a
-		expect(CSSselect('#pseudos a:nth-of-type(odd)', document)).to.have.length(1); //found the odd a
-		expect(CSSselect('#pseudos a:nth-of-type(1)', document)).to.have.length(1); //found the first a
-	},
-
-	':nth-last-of-type(expr)': function () {
-		var second = DomUtils.getElementsByTagName('div', pseudos)[1];
-
-		expect(CSSselect('#pseudos div:nth-last-of-type(3n+1)', document)).to.have.length(2); //found 2 div elements
-		expect(CSSselect('#pseudos a:nth-last-of-type(3n+1)', document)).to.have.length(1); //found 1 a element
-		expect(CSSselect('#pseudos div:nth-last-of-type(5)', document)[0]).to.be(second); //5th nth-last-of-type should be 2nd of 7 elements
-	},
-
-	':first-of-type': function () {
-		expect(CSSselect('#pseudos a:first-of-type', document)[0]).to.be(DomUtils.getElementsByTagName('a', pseudos)[0]); //found first a element
-		expect(CSSselect('#pseudos a:first-of-type', document)).to.have.length(1); //found only 1
-	},
-
-	':last-of-type': function () {
-		var all = DomUtils.getElementsByTagName('div', pseudos);
-		expect(CSSselect('#pseudos div:last-of-type', document)[0]).to.be(all[all.length - 1]); //found last div element
-		expect(CSSselect('#pseudos div:last-of-type', document)).to.have.length(1); //found only 1
-	},
-
-	':only-of-type': function () {
-		expect(CSSselect('#pseudos a:only-of-type', document)[0]).to.be(DomUtils.getElementsByTagName('a', pseudos)[0]); //found the only a element
-		expect(CSSselect('#pseudos a:first-of-type', document)).to.have.length(1); //found only 1
-	},
-
-	':target': function () {
-		location.hash = '';
-		expect(CSSselect('#pseudos:target', document)).to.be.empty(); //#pseudos is not the target
-		location.hash = '#pseudos';
-		expect(CSSselect('#pseudos:target', document)).to.have.length(1); //now #pseudos is the target
-		location.hash = '';
-	},
-
-	'custom pseudos': function() {
+	"pseudo-selectors": {
+		":contains": function(){
+			expect(CSSselect("li:contains(humans)", document)).to.have.length(1); //found by "element:contains(text)"
+			expect(CSSselect(":contains(humans)", document)).to.have.length(5); //found by ":contains(text)", including all ancestors
+		// * is an important case, can cause weird errors
+			expect(CSSselect("*:contains(humans)", document)).to.have.length(5); //found by "*:contains(text)", including all ancestors
+			expect(CSSselect("ol:contains(humans)", document)).to.have.length(1); //found by "ancestor:contains(text)"
+		},
+
+		":not": function(){
+			expect(CSSselect(".odd:not(div)", document)).to.have.length(1); //found one .odd :not an <a>
+		},
+
+		":first-child": function (){
+			expect(CSSselect("#pseudos div:first-child", document)[0]).to.be(pseudos[0]); //found first child
+			expect(CSSselect("#pseudos div:first-child", document)).to.have.length(1); //found only 1
+		},
+
+		":last-child": function (){
+			var all = DomUtils.getElementsByTagName("div", pseudos);
+			expect(CSSselect("#pseudos div:last-child", document)[0]).to.be(all[all.length - 1]); //found last child
+			expect(CSSselect("#pseudos div:last-child", document)).to.have.length(1); //found only 1
+		},
+
+		"ol > li[attr=\"boosh\"]:last-child": function (){
+			var expected = DomUtils.getElementById("attr-child-boosh", document);
+			expect(CSSselect("ol > li[attr=\"boosh\"]:last-child", document)).to.have.length(1); //only 1 element found
+			expect(CSSselect("ol > li[attr=\"boosh\"]:last-child", document)[0]).to.be(expected); //found correct element
+		},
+
+		":nth-child(odd|even|x)": function (){
+			var second = DomUtils.getElementsByTagName("div", pseudos)[1];
+			expect(CSSselect("#pseudos :nth-child(odd)", document)).to.have.length(4); //found 4 odd elements
+			expect(CSSselect("#pseudos div:nth-child(odd)", document)).to.have.length(3); //found 3 odd elements with div tag
+			expect(CSSselect("#pseudos div:nth-child(even)", document)).to.have.length(3); //found 3 even elements with div tag
+			expect(CSSselect("#pseudos div:nth-child(2)", document)[0]).to.be(second); //found 2nd nth-child of pseudos
+		},
+
+		":nth-child(expr)": function (){
+			var fifth = DomUtils.getElementsByTagName("a", pseudos)[0];
+			var sixth = DomUtils.getElementsByTagName("div", pseudos)[4];
+
+			expect(CSSselect("#pseudos :nth-child(3n+1)", document)).to.have.length(3); //found 3 elements
+			expect(CSSselect("#pseudos :nth-child(+3n-2)", document)).to.have.length(3); //found 3 elements'
+			expect(CSSselect("#pseudos :nth-child(-n+6)", document)).to.have.length(6); //found 6 elements
+			expect(CSSselect("#pseudos :nth-child(-n+5)", document)).to.have.length(5); //found 5 elements
+			expect(CSSselect("#pseudos :nth-child(3n+2)", document)[1]).to.be(fifth); //second :nth-child(3n+2) is the fifth child
+			expect(CSSselect("#pseudos :nth-child(3n)", document)[1]).to.be(sixth); //second :nth-child(3n) is the sixth child
+		},
+
+		":nth-last-child(odd|even|x)": function (){
+			var second = DomUtils.getElementsByTagName("div", pseudos)[1];
+			expect(CSSselect("#pseudos :nth-last-child(odd)", document)).to.have.length(4); //found 4 odd elements
+			expect(CSSselect("#pseudos div:nth-last-child(odd)", document)).to.have.length(3); //found 3 odd elements with div tag
+			expect(CSSselect("#pseudos div:nth-last-child(even)", document)).to.have.length(3); //found 3 even elements with div tag
+			expect(CSSselect("#pseudos div:nth-last-child(6)", document)[0]).to.be(second); //6th nth-last-child should be 2nd of 7 elements
+		},
+
+		":nth-last-child(expr)": function (){
+			var third = DomUtils.getElementsByTagName("div", pseudos)[2];
+
+			expect(CSSselect("#pseudos :nth-last-child(3n+1)", document)).to.have.length(3); //found 3 elements
+			expect(CSSselect("#pseudos :nth-last-child(3n-2)", document)).to.have.length(3); //found 3 elements
+			expect(CSSselect("#pseudos :nth-last-child(-n+6)", document)).to.have.length(6); //found 6 elements
+			expect(CSSselect("#pseudos :nth-last-child(-n+5)", document)).to.have.length(5); //found 5 elements
+			expect(CSSselect("#pseudos :nth-last-child(3n+2)", document)[0]).to.be(third); //first :nth-last-child(3n+2) is the third child
+		},
+
+		":nth-of-type(expr)": function (){
+			var a = DomUtils.getElementsByTagName("a", pseudos)[0];
+
+			expect(CSSselect("#pseudos div:nth-of-type(3n+1)", document)).to.have.length(2); //found 2 div elements
+			expect(CSSselect("#pseudos a:nth-of-type(3n+1)", document)).to.have.length(1); //found 1 a element
+			expect(CSSselect("#pseudos a:nth-of-type(3n+1)", document)[0]).to.be(a); //found the right a element
+			expect(CSSselect("#pseudos a:nth-of-type(3n)", document)).to.be.empty(); //no matches for every third a
+			expect(CSSselect("#pseudos a:nth-of-type(odd)", document)).to.have.length(1); //found the odd a
+			expect(CSSselect("#pseudos a:nth-of-type(1)", document)).to.have.length(1); //found the first a
+		},
+
+		":nth-last-of-type(expr)": function (){
+			var second = DomUtils.getElementsByTagName("div", pseudos)[1];
+
+			expect(CSSselect("#pseudos div:nth-last-of-type(3n+1)", document)).to.have.length(2); //found 2 div elements
+			expect(CSSselect("#pseudos a:nth-last-of-type(3n+1)", document)).to.have.length(1); //found 1 a element
+			expect(CSSselect("#pseudos div:nth-last-of-type(5)", document)[0]).to.be(second); //5th nth-last-of-type should be 2nd of 7 elements
+		},
+
+		":first-of-type": function (){
+			expect(CSSselect("#pseudos a:first-of-type", document)[0]).to.be(DomUtils.getElementsByTagName("a", pseudos)[0]); //found first a element
+			expect(CSSselect("#pseudos a:first-of-type", document)).to.have.length(1); //found only 1
+		},
+
+		":last-of-type": function (){
+			var all = DomUtils.getElementsByTagName("div", pseudos);
+			expect(CSSselect("#pseudos div:last-of-type", document)[0]).to.be(all[all.length - 1]); //found last div element
+			expect(CSSselect("#pseudos div:last-of-type", document)).to.have.length(1); //found only 1
+		},
+
+		":only-of-type": function (){
+			expect(CSSselect("#pseudos a:only-of-type", document)[0]).to.be(DomUtils.getElementsByTagName("a", pseudos)[0]); //found the only a element
+			expect(CSSselect("#pseudos a:first-of-type", document)).to.have.length(1); //found only 1
+		},
+
+		":target": function (){
+			location.hash = "";
+			expect(CSSselect("#pseudos:target", document)).to.be.empty(); //#pseudos is not the target
+			location.hash = "#pseudos";
+			expect(CSSselect("#pseudos:target", document)).to.have.length(1); //now #pseudos is the target
+			location.hash = "";
+		},
+
+		"custom pseudos": function(){
 		// :humanoid implemented just for testing purposes
-		expect(CSSselect(':humanoid', document)).to.have.length(2); //selected using custom pseudo
-	}
+			expect(CSSselect(":humanoid", document)).to.have.length(2); //selected using custom pseudo
+		}
 
-},
+	},
 
 /*
 'argument types': {
@@ -468,82 +466,82 @@ module.exports = {
 },
 */
 
-'is()': {
-	'simple selectors': function () {
-		expect(CSSselect.is(el, 'li')).to.be.ok(); //tag
-		expect(CSSselect.is(el, '*')).to.be.ok(); //wildcard
-		expect(CSSselect.is(el, '#attr-child-boosh')).to.be.ok(); //#id
-		expect(CSSselect.is(el, '[attr]')).to.be.ok(); //[attr]
-		expect(CSSselect.is(el, '[attr=boosh]')).to.be.ok(); //[attr=val]
-		expect(CSSselect.is(el, 'div')).to.not.be.ok(); //wrong tag
-		expect(CSSselect.is(el, '#foo')).to.not.be.ok(); //wrong #id
-		expect(CSSselect.is(el, '[foo]')).to.not.be.ok(); //wrong [attr]
-		expect(CSSselect.is(el, '[attr=foo]')).to.not.be.ok(); //wrong [attr=val]
-	},
-	'selector sequences': function () {
-		expect(CSSselect.is(el, 'li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag#id[attr=val]
-		expect(CSSselect.is(el, 'div#attr-child-boosh[attr=boosh]')).to.not.be.ok(); //wrong tag#id[attr=val]
-	},
-	'selector sequences combinators': function () {
-		expect(CSSselect.is(el, 'ol li')).to.be.ok(); //tag tag
-		expect(CSSselect.is(el, 'ol>li')).to.be.ok(); //tag>tag
-		expect(CSSselect.is(el, 'ol>li+li')).to.be.ok(); //tab>tag+tag
-		expect(CSSselect.is(el, 'ol#list li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag#id tag#id[attr=val]
-		expect(CSSselect.is(el, 'ol#list>li#attr-child-boosh[attr=boosh]')).to.not.be.ok(); //wrong tag#id>tag#id[attr=val]
-		expect(CSSselect.is(el, 'ol ol li#attr-child-boosh[attr=boosh]')).to.be.ok(); //tag tag tag#id[attr=val]
-		expect(CSSselect.is(CSSselect('#token-four', document)[0], 'div#fixtures>div a')).to.be.ok(); //tag#id>tag tag where ambiguous middle tag requires backtracking
-	},
-	'pseudos': function() {
+	"is()": {
+		"simple selectors": function (){
+			expect(CSSselect.is(el, "li")).to.be.ok(); //tag
+			expect(CSSselect.is(el, "*")).to.be.ok(); //wildcard
+			expect(CSSselect.is(el, "#attr-child-boosh")).to.be.ok(); //#id
+			expect(CSSselect.is(el, "[attr]")).to.be.ok(); //[attr]
+			expect(CSSselect.is(el, "[attr=boosh]")).to.be.ok(); //[attr=val]
+			expect(CSSselect.is(el, "div")).to.not.be.ok(); //wrong tag
+			expect(CSSselect.is(el, "#foo")).to.not.be.ok(); //wrong #id
+			expect(CSSselect.is(el, "[foo]")).to.not.be.ok(); //wrong [attr]
+			expect(CSSselect.is(el, "[attr=foo]")).to.not.be.ok(); //wrong [attr=val]
+		},
+		"selector sequences": function (){
+			expect(CSSselect.is(el, "li#attr-child-boosh[attr=boosh]")).to.be.ok(); //tag#id[attr=val]
+			expect(CSSselect.is(el, "div#attr-child-boosh[attr=boosh]")).to.not.be.ok(); //wrong tag#id[attr=val]
+		},
+		"selector sequences combinators": function (){
+			expect(CSSselect.is(el, "ol li")).to.be.ok(); //tag tag
+			expect(CSSselect.is(el, "ol>li")).to.be.ok(); //tag>tag
+			expect(CSSselect.is(el, "ol>li+li")).to.be.ok(); //tab>tag+tag
+			expect(CSSselect.is(el, "ol#list li#attr-child-boosh[attr=boosh]")).to.be.ok(); //tag#id tag#id[attr=val]
+			expect(CSSselect.is(el, "ol#list>li#attr-child-boosh[attr=boosh]")).to.not.be.ok(); //wrong tag#id>tag#id[attr=val]
+			expect(CSSselect.is(el, "ol ol li#attr-child-boosh[attr=boosh]")).to.be.ok(); //tag tag tag#id[attr=val]
+			expect(CSSselect.is(CSSselect("#token-four", document)[0], "div#fixtures>div a")).to.be.ok(); //tag#id>tag tag where ambiguous middle tag requires backtracking
+		},
+		"pseudos": function(){
 		//TODO: more tests!
-		expect(CSSselect.is(el, 'li:contains(hello)')).to.be.ok(); //matching :contains(text)
-		expect(CSSselect.is(el, 'li:contains(human)')).to.not.be.ok(); //non-matching :contains(text)
-		expect(CSSselect.is(CSSselect('#list>li', document)[2], ':humanoid')).to.be.ok(); //matching custom pseudo
-		expect(CSSselect.is(CSSselect('#list>li', document)[1], ':humanoid')).to.not.be.ok(); //non-matching custom pseudo
-	},
-	'context': function () {
-		expect(CSSselect.is(el, 'li#attr-child-boosh[attr=boosh]', {context: CSSselect('#list', document)[0]})).to.be.ok(); //context
-		expect(CSSselect.is(el, 'ol#list li#attr-child-boosh[attr=boosh]', {context: CSSselect('#boosh', document)[0]})).to.not.be.ok(); //wrong context
-	}
-},
-
-'selecting elements in other documents': {
-	'get element by id': function () {
-		var result = CSSselect('#hsoob', doc);
-		expect(result[0]).to.be.ok(); //found element with id=hsoob
-	},
-
-	'get elements by class': function () {
-		expect(CSSselect('#hsoob .a', doc)).to.have.length(2); //found two elements
-		expect(CSSselect('#hsoob div.a', doc)[0]).to.be.ok(); //found one element
-		expect(CSSselect('#hsoob div', doc)).to.have.length(2); //found two {div} elements
-		expect(CSSselect('#hsoob span', doc)[0]).to.be.ok(); //found one {span} element
-		expect(CSSselect('#hsoob div div', doc)[0]).to.be.ok(); //found a single div
-		expect(CSSselect('p.odd', doc)).to.have.length(1); //found single br
-	},
-
-	'complex selectors': function () {
-		expect(CSSselect('.d ~ .sib', doc)).to.have.length(2); //found one ~ sibling
-		expect(CSSselect('.a .d + .sib', doc)).to.have.length(1); //found 2 + siblings
-		expect(CSSselect('#hsoob > div > .h', doc)).to.have.length(1); //found span using child selectors
-		expect(CSSselect('.a .d ~ .sib[test="f g"]', doc)).to.have.length(1); //found 1 ~ sibling with test attribute
+			expect(CSSselect.is(el, "li:contains(hello)")).to.be.ok(); //matching :contains(text)
+			expect(CSSselect.is(el, "li:contains(human)")).to.not.be.ok(); //non-matching :contains(text)
+			expect(CSSselect.is(CSSselect("#list>li", document)[2], ":humanoid")).to.be.ok(); //matching custom pseudo
+			expect(CSSselect.is(CSSselect("#list>li", document)[1], ":humanoid")).to.not.be.ok(); //non-matching custom pseudo
+		},
+		"context": function (){
+			expect(CSSselect.is(el, "li#attr-child-boosh[attr=boosh]", {context: CSSselect("#list", document)[0]})).to.be.ok(); //context
+			expect(CSSselect.is(el, "ol#list li#attr-child-boosh[attr=boosh]", {context: CSSselect("#boosh", document)[0]})).to.not.be.ok(); //wrong context
+		}
 	},
 
-	'byId sub-queries': function () {
-		expect(CSSselect('#hsoob #spanny', doc)).to.have.length(1); //found "#id #id" in frame
-		expect(CSSselect('.a #spanny', doc)).to.have.length(1); //found ".class #id" in frame
-		expect(CSSselect('.a #booshTest #spanny', doc)).to.have.length(1); //found ".class #id #id" in frame
-		expect(CSSselect('> #hsoob', doc)).to.have.length(1) //found "> #id" in frame
-	},
+	"selecting elements in other documents": {
+		"get element by id": function (){
+			var result = CSSselect("#hsoob", doc);
+			expect(result[0]).to.be.ok(); //found element with id=hsoob
+		},
+
+		"get elements by class": function (){
+			expect(CSSselect("#hsoob .a", doc)).to.have.length(2); //found two elements
+			expect(CSSselect("#hsoob div.a", doc)[0]).to.be.ok(); //found one element
+			expect(CSSselect("#hsoob div", doc)).to.have.length(2); //found two {div} elements
+			expect(CSSselect("#hsoob span", doc)[0]).to.be.ok(); //found one {span} element
+			expect(CSSselect("#hsoob div div", doc)[0]).to.be.ok(); //found a single div
+			expect(CSSselect("p.odd", doc)).to.have.length(1); //found single br
+		},
+
+		"complex selectors": function (){
+			expect(CSSselect(".d ~ .sib", doc)).to.have.length(2); //found one ~ sibling
+			expect(CSSselect(".a .d + .sib", doc)).to.have.length(1); //found 2 + siblings
+			expect(CSSselect("#hsoob > div > .h", doc)).to.have.length(1); //found span using child selectors
+			expect(CSSselect(".a .d ~ .sib[test=\"f g\"]", doc)).to.have.length(1); //found 1 ~ sibling with test attribute
+		},
+
+		"byId sub-queries": function (){
+			expect(CSSselect("#hsoob #spanny", doc)).to.have.length(1); //found "#id #id" in frame
+			expect(CSSselect(".a #spanny", doc)).to.have.length(1); //found ".class #id" in frame
+			expect(CSSselect(".a #booshTest #spanny", doc)).to.have.length(1); //found ".class #id #id" in frame
+			expect(CSSselect("> #hsoob", doc)).to.have.length(1) //found "> #id" in frame
+		},
+
+		"byId sub-queries within sub-context": function (){
+			expect(CSSselect("#spanny", CSSselect("#hsoob", doc))).to.have.length(1); //found "#id -> #id" in frame
+			expect(CSSselect(".a #spanny", CSSselect("#hsoob", doc))).to.have.length(1); //found ".class #id" in frame
+			expect(CSSselect(".a #booshTest #spanny", CSSselect("#hsoob", doc))).to.have.length(1); //found ".class #id #id" in frame
+			expect(CSSselect(".a > #booshTest", CSSselect("#hsoob", doc))).to.have.length(1); //found "> .class #id" in frame
+			expect(CSSselect("#booshTest", CSSselect("#spanny", doc)).length).to.not.be.ok(); //shouldn't find #booshTest (ancestor) within #spanny (descendent)
+			expect(CSSselect("#booshTest", CSSselect("#lonelyHsoob", doc)).length).to.not.be.ok(); //shouldn't find #booshTest within #lonelyHsoob (unrelated)
+		}
 
-	'byId sub-queries within sub-context': function () {
-		expect(CSSselect('#spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found "#id -> #id" in frame
-		expect(CSSselect('.a #spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found ".class #id" in frame
-		expect(CSSselect('.a #booshTest #spanny', CSSselect('#hsoob', doc))).to.have.length(1); //found ".class #id #id" in frame
-		expect(CSSselect('.a > #booshTest', CSSselect('#hsoob', doc))).to.have.length(1); //found "> .class #id" in frame
-		expect(CSSselect('#booshTest', CSSselect('#spanny', doc)).length).to.not.be.ok(); //shouldn't find #booshTest (ancestor) within #spanny (descendent)
-		expect(CSSselect('#booshTest', CSSselect('#lonelyHsoob', doc)).length).to.not.be.ok(); //shouldn't find #booshTest within #lonelyHsoob (unrelated)
 	}
 
-}
-
 };
diff --git a/test/sizzle/data/testinit.js b/test/sizzle/data/testinit.js
index c3cd0e1..adfae77 100755
--- a/test/sizzle/data/testinit.js
+++ b/test/sizzle/data/testinit.js
@@ -1,22 +1,22 @@
 var assert = require("assert"),
-    util = require("util"),
-    helper = require("../../tools/helper.js"),
-    CSSselect = helper.CSSselect,
-    path = require("path"),
-    docPath = path.join(__dirname, "index.html"),
-    document = null;
+	helper = require("../../tools/helper.js"),
+	CSSselect = helper.CSSselect,
+	path = require("path"),
+	docPath = path.join(__dirname, "index.html"),
+	document = null;
 
 
 //in this module, the only use-case is to compare arrays of
 function deepEqual(a, b, msg){
 	try {
 		assert.deepEqual(a, b, msg);
-	} catch(e) {
-		function getId(n){return n && n.attribs.id; }
+	} catch(e){
 		e.actual = JSON.stringify(a.map(getId), 0, 2);
 		e.expected = JSON.stringify(b.map(getId), 0, 2);
 		throw e;
 	}
+
+	function getId(n){ return n && n.attribs.id; }
 }
 
 function loadDoc(){
@@ -35,12 +35,12 @@ module.exports = {
  * @example q("main", "foo", "bar")
  * @result [<div id="main">, <span id="foo">, <input id="bar">]
  */
-function q() {
+function q(){
 	var r = [],
 		i = 0;
 
-	for ( ; i < arguments.length; i++ ) {
-		r.push( document.getElementById( arguments[i] ) );
+	for(; i < arguments.length; i++){
+		r.push(document.getElementById(arguments[i]));
 	}
 	return r;
 }
@@ -53,35 +53,22 @@ function q() {
  * @example t("Check for something", "//[a]", ["foo", "baar"]);
  * @result returns true if "//[a]" return two elements with the IDs 'foo' and 'baar'
  */
-function t( a, b, c ) {
+function t(a, b, c){
 	var f = CSSselect(b, document),
 		s = "",
 		i = 0;
 
-	for ( ; i < f.length; i++ ) {
-		s += ( s && "," ) + '"' + f[ i ].id + '"';
+	for(; i < f.length; i++){
+		s += (s && ",") + "\"" + f[ i ].id + "\"";
 	}
 
-	deepEqual(f, q.apply( q, c ), a + " (" + b + ")");
-}
-
-/**
- * Add random number to url to stop caching
- *
- * @example url("data/test.html")
- * @result "data/test.html?10538358428943"
- *
- * @example url("data/test.php?foo=bar")
- * @result "data/test.php?foo=bar&10538358345554"
- */
-function url( value ) {
-	return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
+	deepEqual(f, q.apply(q, c), a + " (" + b + ")");
 }
 
 var xmlDoc = helper.getDOMFromPath(path.join(__dirname, "fries.xml"), { xmlMode: true });
 var filtered = xmlDoc.filter(function(t){return t.type === "tag"});
 xmlDoc.lastChild = filtered[filtered.length - 1];
 
-function createWithFriesXML() {
+function createWithFriesXML(){
 	return xmlDoc;
 }
diff --git a/test/sizzle/selector.js b/test/sizzle/selector.js
index 31f745b..c1ea437 100755
--- a/test/sizzle/selector.js
+++ b/test/sizzle/selector.js
@@ -61,10 +61,6 @@ function jQuery(dom){
 	return ret;
 }
 
-function asyncTest(name, _, func){
-	it(name, func);
-}
-
 beforeEach(function(){
 	document = testInit.loadDoc();
 });
@@ -114,67 +110,67 @@ beforeEach(function(){
 		@example url("data/test.php?foo=bar") => "data/test.php?foo=bar&10538358345554"
 */
 
-test("element", function() {
-	expect( 38 );
+test("element", function(){
+	expect(38);
 
 	var form, all, good, i, obj1, lengthtest,
-		siblingTest, iframe, iframeDoc, html;
+		siblingTest, iframe, html;
 
-	equal( Sizzle("").length, 0, "Empty selector returns an empty array" );
-	deepEqual( Sizzle("div", document.createTextNode("")), [], "Text element as context fails silently" );
+	equal(Sizzle("").length, 0, "Empty selector returns an empty array");
+	deepEqual(Sizzle("div", document.createTextNode("")), [], "Text element as context fails silently");
 	form = document.getElementById("form");
-	ok( !Sizzle.matchesSelector( form, "" ), "Empty string passed to matchesSelector does not match" );
-	equal( Sizzle(" ").length, 0, "Empty selector returns an empty array" );
-	equal( Sizzle("\t").length, 0, "Empty selector returns an empty array" );
+	ok(!Sizzle.matchesSelector(form, ""), "Empty string passed to matchesSelector does not match");
+	equal(Sizzle(" ").length, 0, "Empty selector returns an empty array");
+	equal(Sizzle("\t").length, 0, "Empty selector returns an empty array");
 
-	ok( Sizzle("*").length >= 30, "Select all" );
+	ok(Sizzle("*").length >= 30, "Select all");
 	all = Sizzle("*");
 	good = true;
-	for ( i = 0; i < all.length; i++ ) {
-		if ( all[i].nodeType === 8 ) {
+	for(i = 0; i < all.length; i++){
+		if(all[i].nodeType === 8){
 			good = false;
 		}
 	}
-	ok( good, "Select all elements, no comment nodes" );
-	t( "Element Selector", "html", ["html"] );
-	t( "Element Selector", "body", ["body"] );
-	t( "Element Selector", "#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-
-	t( "Leading space", " #qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Leading tab", "\t#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Leading carriage return", "\r#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Leading line feed", "\n#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Leading form feed", "\f#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Trailing space", "#qunit-fixture p ", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Trailing tab", "#qunit-fixture p\t", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Trailing carriage return", "#qunit-fixture p\r", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Trailing line feed", "#qunit-fixture p\n", ["firstp","ap","sndp","en","sap","first"] );
-	t( "Trailing form feed", "#qunit-fixture p\f", ["firstp","ap","sndp","en","sap","first"] );
-
-	t( "Parent Element", "dl ol", ["empty", "listWithTabIndex"] );
-	t( "Parent Element (non-space descendant combinator)", "dl\tol", ["empty", "listWithTabIndex"] );
+	ok(good, "Select all elements, no comment nodes");
+	t("Element Selector", "html", ["html"]);
+	t("Element Selector", "body", ["body"]);
+	t("Element Selector", "#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+
+	t("Leading space", " #qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+	t("Leading tab", "\t#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+	t("Leading carriage return", "\r#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+	t("Leading line feed", "\n#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+	t("Leading form feed", "\f#qunit-fixture p", ["firstp","ap","sndp","en","sap","first"]);
+	t("Trailing space", "#qunit-fixture p ", ["firstp","ap","sndp","en","sap","first"]);
+	t("Trailing tab", "#qunit-fixture p\t", ["firstp","ap","sndp","en","sap","first"]);
+	t("Trailing carriage return", "#qunit-fixture p\r", ["firstp","ap","sndp","en","sap","first"]);
+	t("Trailing line feed", "#qunit-fixture p\n", ["firstp","ap","sndp","en","sap","first"]);
+	t("Trailing form feed", "#qunit-fixture p\f", ["firstp","ap","sndp","en","sap","first"]);
+
+	t("Parent Element", "dl ol", ["empty", "listWithTabIndex"]);
+	t("Parent Element (non-space descendant combinator)", "dl\tol", ["empty", "listWithTabIndex"]);
 	obj1 = document.getElementById("object1");
-	equal( Sizzle("param", obj1).length, 2, "Object/param as context" );
+	equal(Sizzle("param", obj1).length, 2, "Object/param as context");
 
-	deepEqual( Sizzle("select", form), q("select1","select2","select3","select4","select5"), "Finding selects with a context." );
+	deepEqual(Sizzle("select", form), q("select1","select2","select3","select4","select5"), "Finding selects with a context.");
 
 	// Check for unique-ness and sort order
-	deepEqual( Sizzle("p, div p"), Sizzle("p"), "Check for duplicates: p, div p" );
+	deepEqual(Sizzle("p, div p"), Sizzle("p"), "Check for duplicates: p, div p");
 
-	t( "Checking sort order", "h2, h1", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
+	t("Checking sort order", "h2, h1", ["qunit-header", "qunit-banner", "qunit-userAgent"]);
 	//  t( "Checking sort order", "h2:first, h1:first", ["qunit-header", "qunit-banner"] );
-	t( "Checking sort order", "#qunit-fixture p, #qunit-fixture p a", ["firstp", "simon1", "ap", "google", "groups", "anchor1", "mark", "sndp", "en", "yahoo", "sap", "anchor2", "simon", "first"] );
+	t("Checking sort order", "#qunit-fixture p, #qunit-fixture p a", ["firstp", "simon1", "ap", "google", "groups", "anchor1", "mark", "sndp", "en", "yahoo", "sap", "anchor2", "simon", "first"]);
 
 	// Test Conflict ID
 	lengthtest = document.getElementById("lengthtest");
-	deepEqual( Sizzle("#idTest", lengthtest), q("idTest"), "Finding element with id of ID." );
-	deepEqual( Sizzle("[name='id']", lengthtest), q("idTest"), "Finding element with id of ID." );
-	deepEqual( Sizzle("input[id='idTest']", lengthtest), q("idTest"), "Finding elements with id of ID." );
+	deepEqual(Sizzle("#idTest", lengthtest), q("idTest"), "Finding element with id of ID.");
+	deepEqual(Sizzle("[name='id']", lengthtest), q("idTest"), "Finding element with id of ID.");
+	deepEqual(Sizzle("input[id='idTest']", lengthtest), q("idTest"), "Finding elements with id of ID.");
 
 	siblingTest = document.getElementById("siblingTest"); // TODO
-	deepEqual( Sizzle("div em", siblingTest), [], "Element-rooted QSA does not select based on document context" );
-	deepEqual( Sizzle("div em, div em, div em:not(div em)", siblingTest), [], "Element-rooted QSA does not select based on document context" );
-	deepEqual( Sizzle("div em, em\\,", siblingTest), [], "Escaped commas do not get treated with an id in element-rooted QSA" );
+	deepEqual(Sizzle("div em", siblingTest), [], "Element-rooted QSA does not select based on document context");
+	deepEqual(Sizzle("div em, div em, div em:not(div em)", siblingTest), [], "Element-rooted QSA does not select based on document context");
+	deepEqual(Sizzle("div em, em\\,", siblingTest), [], "Escaped commas do not get treated with an id in element-rooted QSA");
 
 	iframe = document.getElementById("iframe");
 	//iframeDoc.open();
@@ -182,388 +178,386 @@ test("element", function() {
 	iframe.children.forEach(function(e){ e.parent = iframe; });
 	//iframeDoc.close();
 	deepEqual(
-		Sizzle( "p:contains(bar)", iframe ),
+		Sizzle("p:contains(bar)", iframe),
 		[ DomUtils.getElementById("foo", iframe.children) ],
 		"Other document as context"
 	);
 	iframe.children = [];
 
 	html = "";
-	for ( i = 0; i < 100; i++ ) {
+	for(i = 0; i < 100; i++){
 		html = "<div>" + html + "</div>";
 	}
-	html = jQuery( html ).appendTo( document.body );
-	ok( !!Sizzle("body div div div").length, "No stack or performance problems with large amounts of descendents" );
-	ok( !!Sizzle("body>div div div").length, "No stack or performance problems with large amounts of descendents" );
+	html = jQuery(html).appendTo(document.body);
+	ok(!!Sizzle("body div div div").length, "No stack or performance problems with large amounts of descendents");
+	ok(!!Sizzle("body>div div div").length, "No stack or performance problems with large amounts of descendents");
 	html.remove();
 
 	// Real use case would be using .watch in browsers with window.watch (see Issue #157)
 	var elem = document.createElement("tostring");
 	elem.attribs.id = "toString";
 	var siblings = q("qunit-fixture")[0].children;
-	siblings.push( elem );
-	t( "Element name matches Object.prototype property", "tostring#toString", ["toString"] );
+	siblings.push(elem);
+	t("Element name matches Object.prototype property", "tostring#toString", ["toString"]);
 	siblings.pop();
 });
 
-test("XML Document Selectors", function() {
+test("XML Document Selectors", function(){
 	var xml = createWithFriesXML();
-	expect( 11 );
-
-	equal( Sizzle("foo_bar", xml).length, 1, "Element Selector with underscore" );
-	equal( Sizzle(".component", xml).length, 1, "Class selector" );
-	equal( Sizzle("[class*=component]", xml).length, 1, "Attribute selector for class" );
-	equal( Sizzle("property[name=prop2]", xml).length, 1, "Attribute selector with name" );
-	equal( Sizzle("[name=prop2]", xml).length, 1, "Attribute selector with name" );
-	equal( Sizzle("#seite1", xml).length, 1, "Attribute selector with ID" );
-	equal( Sizzle("component#seite1", xml).length, 1, "Attribute selector with ID" );
-	equal( Sizzle.matches( "#seite1", Sizzle("component", xml) ).length, 1, "Attribute selector filter with ID" );
-	equal( Sizzle("meta property thing", xml).length, 2, "Descendent selector and dir caching" );
-	ok( Sizzle.matchesSelector( xml.lastChild, "soap\\:Envelope", { xmlMode: true } ), "Check for namespaced element" );
+	expect(11);
+
+	equal(Sizzle("foo_bar", xml).length, 1, "Element Selector with underscore");
+	equal(Sizzle(".component", xml).length, 1, "Class selector");
+	equal(Sizzle("[class*=component]", xml).length, 1, "Attribute selector for class");
+	equal(Sizzle("property[name=prop2]", xml).length, 1, "Attribute selector with name");
+	equal(Sizzle("[name=prop2]", xml).length, 1, "Attribute selector with name");
+	equal(Sizzle("#seite1", xml).length, 1, "Attribute selector with ID");
+	equal(Sizzle("component#seite1", xml).length, 1, "Attribute selector with ID");
+	equal(Sizzle.matches("#seite1", Sizzle("component", xml)).length, 1, "Attribute selector filter with ID");
+	equal(Sizzle("meta property thing", xml).length, 2, "Descendent selector and dir caching");
+	ok(Sizzle.matchesSelector(xml.lastChild, "soap\\:Envelope", { xmlMode: true }), "Check for namespaced element");
 
 	xml = helper.getDOM("<?xml version='1.0' encoding='UTF-8'?><root><elem id='1'/></root>", { xmlMode: true });
-	equal( Sizzle( "elem:not(:has(*))", xml ).length, 1,
-		"Non-qSA path correctly handles numeric ids (jQuery #14142)" );
+	equal(Sizzle("elem:not(:has(*))", xml).length, 1,
+		"Non-qSA path correctly handles numeric ids (jQuery #14142)");
 });
 
-test("broken", function() {
-	expect( 26 );
+test("broken", function(){
+	expect(26);
 
-	var attrbad,
-		broken = function( name, selector ) {
-			raises(function() {
+	var broken = function(name, selector){
+		raises(function(){
 				// Setting context to null here somehow avoids QUnit's window.error handling
 				// making the e & e.message correct
 				// For whatever reason, without this,
 				// Sizzle.error will be called but no error will be seen in oldIE
-				Sizzle.call( null, selector );
-			}, SyntaxError, name + ": " + selector );
-		};
+			Sizzle.call(null, selector);
+		}, Error, name + ": " + selector);
+	};
 
-	broken( "Broken Selector", "[" );
-	broken( "Broken Selector", "(" );
-	broken( "Broken Selector", "{" );
+	broken("Broken Selector", "[");
+	broken("Broken Selector", "(");
+	broken("Broken Selector", "{");
 	//  broken( "Broken Selector", "<" );
-	broken( "Broken Selector", "()" );
+	broken("Broken Selector", "()");
 	//  broken( "Broken Selector", "<>" );
-	broken( "Broken Selector", "{}" );
-	broken( "Broken Selector", "," );
-	broken( "Broken Selector", ",a" );
-	broken( "Broken Selector", "a," );
+	broken("Broken Selector", "{}");
+	broken("Broken Selector", ",");
+	broken("Broken Selector", ",a");
+	broken("Broken Selector", "a,");
 	// Hangs on IE 9 if regular expression is inefficient
-	broken( "Broken Selector", "[id=012345678901234567890123456789");
-	broken( "Doesn't exist", ":visble" );
-	broken( "Nth-child", ":nth-child" );
+	broken("Broken Selector", "[id=012345678901234567890123456789");
+	broken("Doesn't exist", ":visble");
+	broken("Nth-child", ":nth-child");
 	// Sigh again. IE 9 thinks this is also a real selector
 	// not super critical that we fix this case
-	broken( "Nth-child", ":nth-child(-)" );
+	broken("Nth-child", ":nth-child(-)");
 	// Sigh. WebKit thinks this is a real selector in qSA
 	// They've already fixed this and it'll be coming into
 	// current browsers soon. Currently, Safari 5.0 still has this problem
-	broken( "Nth-child", ":nth-child(asdf)", [] );
-	broken( "Nth-child", ":nth-child(2n+-0)" );
-	broken( "Nth-child", ":nth-child(2+0)" );
-	broken( "Nth-child", ":nth-child(- 1n)" );
-	broken( "Nth-child", ":nth-child(-1 n)" );
-	broken( "First-child", ":first-child(n)" );
-	broken( "Last-child", ":last-child(n)" );
-	broken( "Only-child", ":only-child(n)" );
-	broken( "Nth-last-last-child", ":nth-last-last-child(1)" );
-	broken( "First-last-child", ":first-last-child" );
-	broken( "Last-last-child", ":last-last-child" );
-	broken( "Only-last-child", ":only-last-child" );
+	broken("Nth-child", ":nth-child(asdf)", []);
+	broken("Nth-child", ":nth-child(2n+-0)");
+	broken("Nth-child", ":nth-child(2+0)");
+	broken("Nth-child", ":nth-child(- 1n)");
+	broken("Nth-child", ":nth-child(-1 n)");
+	broken("First-child", ":first-child(n)");
+	broken("Last-child", ":last-child(n)");
+	broken("Only-child", ":only-child(n)");
+	broken("Nth-last-last-child", ":nth-last-last-child(1)");
+	broken("First-last-child", ":first-last-child");
+	broken("Last-last-child", ":last-last-child");
+	broken("Only-last-child", ":only-last-child");
 
 	// Make sure attribute value quoting works correctly. See: #6093
-	attrbad = jQuery("<input type='hidden' value='2' name='foo.baz' id='attrbad1'/><input type='hidden' value='2' name='foo[baz]' id='attrbad2'/>").appendTo("#qunit-fixture");
+	jQuery("<input type='hidden' value='2' name='foo.baz' id='attrbad1'/><input type='hidden' value='2' name='foo[baz]' id='attrbad2'/>").appendTo("#qunit-fixture");
 
-	broken( "Attribute not escaped", "input[name=foo.baz]", [] );
+	broken("Attribute not escaped", "input[name=foo.baz]", []);
 	// Shouldn't be matching those inner brackets
-	broken( "Attribute not escaped", "input[name=foo[baz]]", [] );
+	broken("Attribute not escaped", "input[name=foo[baz]]", []);
 });
 
-test("id", function() {
-	expect( 34 );
-
-	var fiddle, a;
-
-	t( "ID Selector", "#body", ["body"] );
-	t( "ID Selector w/ Element", "body#body", ["body"] );
-	t( "ID Selector w/ Element", "ul#first", [] );
-	t( "ID selector with existing ID descendant", "#firstp #simon1", ["simon1"] );
-	t( "ID selector with non-existant descendant", "#firstp #foobar", [] );
-	t( "ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"] );
-	t( "Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"] );
-	t( "Descendant ID selector using UTF8", "div #台北", ["台北"] );
-	t( "Child ID selector using UTF8", "form > #台北", ["台北"] );
-
-	t( "Escaped ID", "#foo\\:bar", ["foo:bar"] );
-	t( "Escaped ID with descendent", "#foo\\:bar span:not(:input)", ["foo_descendent"] );
-	t( "Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
-	t( "Descendant escaped ID", "div #foo\\:bar", ["foo:bar"] );
-	t( "Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
-	t( "Child escaped ID", "form > #foo\\:bar", ["foo:bar"] );
-	t( "Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+test("id", function(){
+	expect(34);
+
+	var fiddle;
+
+	t("ID Selector", "#body", ["body"]);
+	t("ID Selector w/ Element", "body#body", ["body"]);
+	t("ID Selector w/ Element", "ul#first", []);
+	t("ID selector with existing ID descendant", "#firstp #simon1", ["simon1"]);
+	t("ID selector with non-existant descendant", "#firstp #foobar", []);
+	t("ID selector using UTF8", "#台北Táiběi", ["台北Táiběi"]);
+	t("Multiple ID selectors using UTF8", "#台北Táiběi, #台北", ["台北Táiběi","台北"]);
+	t("Descendant ID selector using UTF8", "div #台北", ["台北"]);
+	t("Child ID selector using UTF8", "form > #台北", ["台北"]);
+
+	t("Escaped ID", "#foo\\:bar", ["foo:bar"]);
+	t("Escaped ID with descendent", "#foo\\:bar span:not(:input)", ["foo_descendent"]);
+	t("Escaped ID", "#test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
+	t("Descendant escaped ID", "div #foo\\:bar", ["foo:bar"]);
+	t("Descendant escaped ID", "div #test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
+	t("Child escaped ID", "form > #foo\\:bar", ["foo:bar"]);
+	t("Child escaped ID", "form > #test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
 
 	fiddle = jQuery("<div id='fiddle\\Foo'><span id='fiddleSpan'></span></div>").appendTo("#qunit-fixture");
 	//  deepEqual( Sizzle( "> span", Sizzle("#fiddle\\\\Foo")[0] ), q([ "fiddleSpan" ]), "Escaped ID as context" );
 	fiddle.remove();
 
-	t( "ID Selector, child ID present", "#form > #radio1", ["radio1"] ); // bug #267
-	t( "ID Selector, not an ancestor ID", "#form #first", [] );
-	t( "ID Selector, not a child ID", "#form > #option1a", [] );
+	t("ID Selector, child ID present", "#form > #radio1", ["radio1"]); // bug #267
+	t("ID Selector, not an ancestor ID", "#form #first", []);
+	t("ID Selector, not a child ID", "#form > #option1a", []);
 
-	t( "All Children of ID", "#foo > *", ["sndp", "en", "sap"] );
-	t( "All Children of ID with no children", "#firstUL > *", [] );
+	t("All Children of ID", "#foo > *", ["sndp", "en", "sap"]);
+	t("All Children of ID with no children", "#firstUL > *", []);
 
-	equal( Sizzle("#tName1")[0].attribs.id, "tName1", "ID selector with same value for a name attribute" );
-	t( "ID selector non-existing but name attribute on an A tag",         "#tName2",      [] );
-	t( "Leading ID selector non-existing but name attribute on an A tag", "#tName2 span", [] );
-	t( "Leading ID selector existing, retrieving the child",              "#tName1 span", ["tName1-span"] );
-	equal( Sizzle("div > div #tName1")[0].attribs.id, Sizzle("#tName1-span")[0].parent.attribs.id, "Ending with ID" );
+	equal(Sizzle("#tName1")[0].attribs.id, "tName1", "ID selector with same value for a name attribute");
+	t("ID selector non-existing but name attribute on an A tag",         "#tName2",      []);
+	t("Leading ID selector non-existing but name attribute on an A tag", "#tName2 span", []);
+	t("Leading ID selector existing, retrieving the child",              "#tName1 span", ["tName1-span"]);
+	equal(Sizzle("div > div #tName1")[0].attribs.id, Sizzle("#tName1-span")[0].parent.attribs.id, "Ending with ID");
 
-	a = jQuery("<a id='backslash\\foo'></a>").appendTo("#qunit-fixture");
-	t( "ID Selector contains backslash", "#backslash\\\\foo", ["backslash\\foo"] );
+	jQuery("<a id='backslash\\foo'></a>").appendTo("#qunit-fixture");
+	t("ID Selector contains backslash", "#backslash\\\\foo", ["backslash\\foo"]);
 
-	t( "ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"] );
+	t("ID Selector on Form with an input that has a name of 'id'", "#lengthtest", ["lengthtest"]);
 
-	t( "ID selector with non-existant ancestor", "#asdfasdf #foobar", [] ); // bug #986
+	t("ID selector with non-existant ancestor", "#asdfasdf #foobar", []); // bug #986
 
-	deepEqual( Sizzle("div#form", document.body), [], "ID selector within the context of another element" );
+	deepEqual(Sizzle("div#form", document.body), [], "ID selector within the context of another element");
 
-	t( "Underscore ID", "#types_all", ["types_all"] );
-	t( "Dash ID", "#qunit-fixture", ["qunit-fixture"] );
+	t("Underscore ID", "#types_all", ["types_all"]);
+	t("Dash ID", "#qunit-fixture", ["qunit-fixture"]);
 
-	t( "ID with weird characters in it", "#name\\+value", ["name+value"] );
+	t("ID with weird characters in it", "#name\\+value", ["name+value"]);
 });
 
-test("class", function() {
-	expect( 26 );
-
-	t( "Class Selector", ".blog", ["mark","simon"] );
-	t( "Class Selector", ".GROUPS", ["groups"] );
-	t( "Class Selector", ".blog.link", ["simon"] );
-	t( "Class Selector w/ Element", "a.blog", ["mark","simon"] );
-	t( "Parent Class Selector", "p .blog", ["mark","simon"] );
-
-	t( "Class selector using UTF8", ".台北Táiběi", ["utf8class1"] );
-	t( "Class selector using UTF8", ".台北", ["utf8class1","utf8class2"] );
-	t( "Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"] );
-	t( "Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"] );
-	t( "Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"] );
-	t( "Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"] );
-
-	t( "Escaped Class", ".foo\\:bar", ["foo:bar"] );
-	t( "Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
-	t( "Descendant escaped Class", "div .foo\\:bar", ["foo:bar"] );
-	t( "Descendant escaped Class", "div .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
-	t( "Child escaped Class", "form > .foo\\:bar", ["foo:bar"] );
-	t( "Child escaped Class", "form > .test\\.foo\\[5\\]bar", ["test.foo[5]bar"] );
+test("class", function(){
+	expect(26);
+
+	t("Class Selector", ".blog", ["mark","simon"]);
+	t("Class Selector", ".GROUPS", ["groups"]);
+	t("Class Selector", ".blog.link", ["simon"]);
+	t("Class Selector w/ Element", "a.blog", ["mark","simon"]);
+	t("Parent Class Selector", "p .blog", ["mark","simon"]);
+
+	t("Class selector using UTF8", ".台北Táiběi", ["utf8class1"]);
+	t("Class selector using UTF8", ".台北", ["utf8class1","utf8class2"]);
+	t("Class selector using UTF8", ".台北Táiběi.台北", ["utf8class1"]);
+	t("Class selector using UTF8", ".台北Táiběi, .台北", ["utf8class1","utf8class2"]);
+	t("Descendant class selector using UTF8", "div .台北Táiběi", ["utf8class1"]);
+	t("Child class selector using UTF8", "form > .台北Táiběi", ["utf8class1"]);
+
+	t("Escaped Class", ".foo\\:bar", ["foo:bar"]);
+	t("Escaped Class", ".test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
+	t("Descendant escaped Class", "div .foo\\:bar", ["foo:bar"]);
+	t("Descendant escaped Class", "div .test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
+	t("Child escaped Class", "form > .foo\\:bar", ["foo:bar"]);
+	t("Child escaped Class", "form > .test\\.foo\\[5\\]bar", ["test.foo[5]bar"]);
 
 	var div = document.createElement("div");
 	div.children = helper.getDOM("<div class='test e'></div><div class='test'></div>");
 	div.children.forEach(function(e){
 		e.parent = div;
 	});
-	deepEqual( Sizzle(".e", div), [ div.children[0] ], "Finding a second class." );
+	deepEqual(Sizzle(".e", div), [ div.children[0] ], "Finding a second class.");
 
 	var lastChild = div.children[div.children.length - 1];
 	lastChild.attribs.class = "e";
 
-	deepEqual( Sizzle(".e", div), [ div.children[0], lastChild ], "Finding a modified class." );
+	deepEqual(Sizzle(".e", div), [ div.children[0], lastChild ], "Finding a modified class.");
 
-	ok( !Sizzle.matchesSelector( div, ".null"), ".null does not match an element with no class" );
-	ok( !Sizzle.matchesSelector( div.children[0], ".null div"), ".null does not match an element with no class" );
+	ok(!Sizzle.matchesSelector(div, ".null"), ".null does not match an element with no class");
+	ok(!Sizzle.matchesSelector(div.children[0], ".null div"), ".null does not match an element with no class");
 	div.attribs.class = "null";
-	ok( Sizzle.matchesSelector( div, ".null"), ".null matches element with class 'null'" );
-	ok( Sizzle.matchesSelector( div.children[0], ".null div"), "caching system respects DOM changes" );
-	ok( !Sizzle.matchesSelector( document, ".foo" ), "testing class on document doesn't error" );
+	ok(Sizzle.matchesSelector(div, ".null"), ".null matches element with class 'null'");
+	ok(Sizzle.matchesSelector(div.children[0], ".null div"), "caching system respects DOM changes");
+	ok(!Sizzle.matchesSelector(document, ".foo"), "testing class on document doesn't error");
 	//ok( !Sizzle.matchesSelector( window, ".foo" ), "testing class on window doesn't error" );
 
 	lastChild.attribs.class += " hasOwnProperty toString";
-	deepEqual( Sizzle(".e.hasOwnProperty.toString", div), [ lastChild ], "Classes match Object.prototype properties" );
+	deepEqual(Sizzle(".e.hasOwnProperty.toString", div), [ lastChild ], "Classes match Object.prototype properties");
 
 	div = jQuery("<div><svg width='200' height='250' version='1.1' xmlns='http://www.w3.org/2000/svg'><rect x='10' y='10' width='30' height='30' class='foo'></rect></svg></div>")[0];
-	equal( Sizzle(".foo", div).length, 1, "Class selector against SVG" );
+	equal(Sizzle(".foo", div).length, 1, "Class selector against SVG");
 });
 
-test("name", function() {
-	expect( 13 );
+test("name", function(){
+	expect(13);
 
 	var form;
 
-	t( "Name selector", "input[name=action]", ["text1"] );
-	t( "Name selector with single quotes", "input[name='action']", ["text1"] );
-	t( "Name selector with double quotes", "input[name=\"action\"]", ["text1"] );
+	t("Name selector", "input[name=action]", ["text1"]);
+	t("Name selector with single quotes", "input[name='action']", ["text1"]);
+	t("Name selector with double quotes", "input[name=\"action\"]", ["text1"]);
 
-	t( "Name selector non-input", "[name=example]", ["name-is-example"] );
-	t( "Name selector non-input", "[name=div]", ["name-is-div"] );
-	t( "Name selector non-input", "*[name=iframe]", ["iframe"] );
+	t("Name selector non-input", "[name=example]", ["name-is-example"]);
+	t("Name selector non-input", "[name=div]", ["name-is-div"]);
+	t("Name selector non-input", "*[name=iframe]", ["iframe"]);
 
-	t( "Name selector for grouped input", "input[name='types[]']", ["types_all", "types_anime", "types_movie"] );
+	t("Name selector for grouped input", "input[name='types[]']", ["types_all", "types_anime", "types_movie"]);
 
 	form = document.getElementById("form");
-	deepEqual( Sizzle("input[name=action]", form), q("text1"), "Name selector within the context of another element" );
-	deepEqual( Sizzle("input[name='foo[bar]']", form), q("hidden2"), "Name selector for grouped form element within the context of another element" );
+	deepEqual(Sizzle("input[name=action]", form), q("text1"), "Name selector within the context of another element");
+	deepEqual(Sizzle("input[name='foo[bar]']", form), q("hidden2"), "Name selector for grouped form element within the context of another element");
 
 	form = jQuery("<form><input name='id'/></form>").appendTo("body");
-	equal( Sizzle("input", form[0]).length, 1, "Make sure that rooted queries on forms (with possible expandos) work." );
+	equal(Sizzle("input", form[0]).length, 1, "Make sure that rooted queries on forms (with possible expandos) work.");
 
 	form.remove();
 
-	t( "Find elements that have similar IDs", "[name=tName1]", ["tName1ID"] );
-	t( "Find elements that have similar IDs", "[name=tName2]", ["tName2ID"] );
-	t( "Find elements that have similar IDs", "#tName2ID", ["tName2ID"] );
+	t("Find elements that have similar IDs", "[name=tName1]", ["tName1ID"]);
+	t("Find elements that have similar IDs", "[name=tName2]", ["tName2ID"]);
+	t("Find elements that have similar IDs", "#tName2ID", ["tName2ID"]);
 });
 
-test("multiple", function() {
+test("multiple", function(){
 	expect(6);
 
-	t( "Comma Support", "h2, #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
-	t( "Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
-	t( "Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
-	t( "Comma Support", "h2,#qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
-	t( "Comma Support", "h2,#qunit-fixture p ", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
-	t( "Comma Support", "h2\t,\r#qunit-fixture p\n", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"] );
+	t("Comma Support", "h2, #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
+	t("Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
+	t("Comma Support", "h2 , #qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
+	t("Comma Support", "h2,#qunit-fixture p", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
+	t("Comma Support", "h2,#qunit-fixture p ", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
+	t("Comma Support", "h2\t,\r#qunit-fixture p\n", ["qunit-banner","qunit-userAgent","firstp","ap","sndp","en","sap","first"]);
 });
 
-test("child and adjacent", function() {
-	expect( 42 );
-
-	var siblingFirst, en, nothiddendiv;
-
-	t( "Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"] );
-	t( "Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"] );
-	t( "Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"] );
-	t( "Child", "p>a", ["simon1","google","groups","mark","yahoo","simon"] );
-	t( "Child w/ Class", "p > a.blog", ["mark","simon"] );
-	t( "All Children", "code > *", ["anchor1","anchor2"] );
-	t( "All Grandchildren", "p > * > *", ["anchor1","anchor2"] );
-	t( "Adjacent", "#qunit-fixture a + a", ["groups", "tName2ID"] );
-	t( "Adjacent", "#qunit-fixture a +a", ["groups", "tName2ID"] );
-	t( "Adjacent", "#qunit-fixture a+ a", ["groups", "tName2ID"] );
-	t( "Adjacent", "#qunit-fixture a+a", ["groups", "tName2ID"] );
-	t( "Adjacent", "p + p", ["ap","en","sap"] );
-	t( "Adjacent", "p#firstp + p", ["ap"] );
-	t( "Adjacent", "p[lang=en] + p", ["sap"] );
-	t( "Adjacent", "a.GROUPS + code + a", ["mark"] );
-	t( "Comma, Child, and Adjacent", "#qunit-fixture a + a, code > a", ["groups","anchor1","anchor2","tName2ID"] );
-	t( "Element Preceded By", "#qunit-fixture p ~ div", ["foo", "nothiddendiv", "moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] );
-	t( "Element Preceded By", "#first ~ div", ["moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"] );
-	t( "Element Preceded By", "#groups ~ a", ["mark"] );
-	t( "Element Preceded By", "#length ~ input", ["idTest"] );
-	t( "Element Preceded By", "#siblingfirst ~ em", ["siblingnext", "siblingthird"] );
-	t( "Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", ["siblingspan"] );
-	t( "Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", ["siblingfirst"] );
+test("child and adjacent", function(){
+	expect(42);
+
+	var siblingFirst, en;
+
+	t("Child", "p > a", ["simon1","google","groups","mark","yahoo","simon"]);
+	t("Child", "p> a", ["simon1","google","groups","mark","yahoo","simon"]);
+	t("Child", "p >a", ["simon1","google","groups","mark","yahoo","simon"]);
+	t("Child", "p>a", ["simon1","google","groups","mark","yahoo","simon"]);
+	t("Child w/ Class", "p > a.blog", ["mark","simon"]);
+	t("All Children", "code > *", ["anchor1","anchor2"]);
+	t("All Grandchildren", "p > * > *", ["anchor1","anchor2"]);
+	t("Adjacent", "#qunit-fixture a + a", ["groups", "tName2ID"]);
+	t("Adjacent", "#qunit-fixture a +a", ["groups", "tName2ID"]);
+	t("Adjacent", "#qunit-fixture a+ a", ["groups", "tName2ID"]);
+	t("Adjacent", "#qunit-fixture a+a", ["groups", "tName2ID"]);
+	t("Adjacent", "p + p", ["ap","en","sap"]);
+	t("Adjacent", "p#firstp + p", ["ap"]);
+	t("Adjacent", "p[lang=en] + p", ["sap"]);
+	t("Adjacent", "a.GROUPS + code + a", ["mark"]);
+	t("Comma, Child, and Adjacent", "#qunit-fixture a + a, code > a", ["groups","anchor1","anchor2","tName2ID"]);
+	t("Element Preceded By", "#qunit-fixture p ~ div", ["foo", "nothiddendiv", "moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"]);
+	t("Element Preceded By", "#first ~ div", ["moretests","tabindex-tests", "liveHandlerOrder", "siblingTest"]);
+	t("Element Preceded By", "#groups ~ a", ["mark"]);
+	t("Element Preceded By", "#length ~ input", ["idTest"]);
+	t("Element Preceded By", "#siblingfirst ~ em", ["siblingnext", "siblingthird"]);
+	t("Element Preceded By (multiple)", "#siblingTest em ~ em ~ em ~ span", ["siblingspan"]);
+	t("Element Preceded By, Containing", "#liveHandlerOrder ~ div em:contains('1')", ["siblingfirst"]);
 
 	siblingFirst = document.getElementById("siblingfirst");
 
-	//deepEqual( Sizzle("~ em", siblingFirst), q("siblingnext", "siblingthird"), "Element Preceded By with a context." );
-	//deepEqual( Sizzle("+ em", siblingFirst), q("siblingnext"), "Element Directly Preceded By with a context." );
+	deepEqual(Sizzle("~ em", siblingFirst), q("siblingnext", "siblingthird"), "Element Preceded By with a context.");
+	deepEqual(Sizzle("+ em", siblingFirst), q("siblingnext"), "Element Directly Preceded By with a context.");
 	//deepEqual( Sizzle("~ em:first", siblingFirst), q("siblingnext"), "Element Preceded By positional with a context." );
 
 	en = document.getElementById("en");
-	//deepEqual( Sizzle("+ p, a", en), q("yahoo", "sap"), "Compound selector with context, beginning with sibling test." );
-	//deepEqual( Sizzle("a, + p", en), q("yahoo", "sap"), "Compound selector with context, containing sibling test." );
+	deepEqual(Sizzle("+ p, a", en), q("yahoo", "sap"), "Compound selector with context, beginning with sibling test.");
+	deepEqual(Sizzle("a, + p", en), q("yahoo", "sap"), "Compound selector with context, containing sibling test.");
 
-	t( "Multiple combinators selects all levels", "#siblingTest em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] );
-	t( "Multiple combinators selects all levels", "#siblingTest > em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"] );
-	t( "Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", ["siblingspan"] );
-	t( "Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", [] );
+	t("Multiple combinators selects all levels", "#siblingTest em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"]);
+	t("Multiple combinators selects all levels", "#siblingTest > em *", ["siblingchild", "siblinggrandchild", "siblinggreatgrandchild"]);
+	t("Multiple sibling combinators doesn't miss general siblings", "#siblingTest > em:first-child + em ~ span", ["siblingspan"]);
+	t("Combinators are not skipped when mixing general and specific", "#siblingTest > em:contains('x') + em ~ span", []);
 
-	equal( Sizzle("#listWithTabIndex").length, 1, "Parent div for next test is found via ID (#8310)" );
+	equal(Sizzle("#listWithTabIndex").length, 1, "Parent div for next test is found via ID (#8310)");
 	//equal( Sizzle("#listWithTabIndex li:eq(2) ~ li").length, 1, "Find by general sibling combinator (#8310)" );
-	equal( Sizzle("#__sizzle__").length, 0, "Make sure the temporary id assigned by sizzle is cleared out (#8310)" );
-	equal( Sizzle("#listWithTabIndex").length, 1, "Parent div for previous test is still found via ID (#8310)" );
+	equal(Sizzle("#__sizzle__").length, 0, "Make sure the temporary id assigned by sizzle is cleared out (#8310)");
+	equal(Sizzle("#listWithTabIndex").length, 1, "Parent div for previous test is still found via ID (#8310)");
 
-	t( "Verify deep class selector", "div.blah > p > a", [] );
+	t("Verify deep class selector", "div.blah > p > a", []);
 
-	t( "No element deep selector", "div.foo > span > a", [] );
+	t("No element deep selector", "div.foo > span > a", []);
 
-	nothiddendiv = document.getElementById("nothiddendiv");
 	//deepEqual( Sizzle("> :first", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" );
 	//deepEqual( Sizzle("> :eq(0)", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" );
 	//deepEqual( Sizzle("> *:first", nothiddendiv), q("nothiddendivchild"), "Verify child context positional selector" );
 
-	t( "Non-existant ancestors", ".fototab > .thumbnails > a", [] );
+	t("Non-existant ancestors", ".fototab > .thumbnails > a", []);
 });
 
-test("attributes", function() {
-	expect( 76 );
+test("attributes", function(){
+	expect(76);
 
 	var opt, input, attrbad, div;
 
-	t( "Attribute Exists", "#qunit-fixture a[title]", ["google"] );
-	t( "Attribute Exists (case-insensitive)", "#qunit-fixture a[TITLE]", ["google"] );
-	t( "Attribute Exists", "#qunit-fixture *[title]", ["google"] );
-	t( "Attribute Exists", "#qunit-fixture [title]", ["google"] );
-	t( "Attribute Exists", "#qunit-fixture a[ title ]", ["google"] );
+	t("Attribute Exists", "#qunit-fixture a[title]", ["google"]);
+	t("Attribute Exists (case-insensitive)", "#qunit-fixture a[TITLE]", ["google"]);
+	t("Attribute Exists", "#qunit-fixture *[title]", ["google"]);
+	t("Attribute Exists", "#qunit-fixture [title]", ["google"]);
+	t("Attribute Exists", "#qunit-fixture a[ title ]", ["google"]);
 
-	t( "Boolean attribute exists", "#select2 option[selected]", ["option2d"]);
-	t( "Boolean attribute equals", "#select2 option[selected='selected']", ["option2d"]);
+	t("Boolean attribute exists", "#select2 option[selected]", ["option2d"]);
+	t("Boolean attribute equals", "#select2 option[selected='selected']", ["option2d"]);
 
-	t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"] );
-	t( "Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"] );
-	t( "Attribute Equals", "#qunit-fixture a[rel=bookmark]", ["simon1"] );
-	t( "Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", ["google"] );
-	t( "Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", ["simon1"] );
-	t( "Attribute Equals Number", "#qunit-fixture option[value=1]", ["option1b","option2b","option3b","option4b","option5c"] );
-	t( "Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", ["foodWithNegativeTabIndex"] );
+	t("Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"]);
+	t("Attribute Equals", "#qunit-fixture a[rel='bookmark']", ["simon1"]);
+	t("Attribute Equals", "#qunit-fixture a[rel=bookmark]", ["simon1"]);
+	t("Attribute Equals", "#qunit-fixture a[href='http://www.google.com/']", ["google"]);
+	t("Attribute Equals", "#qunit-fixture a[ rel = 'bookmark' ]", ["simon1"]);
+	t("Attribute Equals Number", "#qunit-fixture option[value=1]", ["option1b","option2b","option3b","option4b","option5c"]);
+	t("Attribute Equals Number", "#qunit-fixture li[tabIndex=-1]", ["foodWithNegativeTabIndex"]);
 
 	document.getElementById("anchor2").href = "#2";
-	t( "href Attribute", "p a[href^=#]", ["anchor2"] );
-	t( "href Attribute", "p a[href*=#]", ["simon1", "anchor2"] );
+	t("href Attribute", "p a[href^=#]", ["anchor2"]);
+	t("href Attribute", "p a[href*=#]", ["simon1", "anchor2"]);
 
-	t( "for Attribute", "form label[for]", ["label-for"] );
-	t( "for Attribute in form", "#form [for=action]", ["label-for"] );
+	t("for Attribute", "form label[for]", ["label-for"]);
+	t("for Attribute in form", "#form [for=action]", ["label-for"]);
 
-	t( "Attribute containing []", "input[name^='foo[']", ["hidden2"] );
-	t( "Attribute containing []", "input[name^='foo[bar]']", ["hidden2"] );
-	t( "Attribute containing []", "input[name*='[bar]']", ["hidden2"] );
-	t( "Attribute containing []", "input[name$='bar]']", ["hidden2"] );
-	t( "Attribute containing []", "input[name$='[bar]']", ["hidden2"] );
-	t( "Attribute containing []", "input[name$='foo[bar]']", ["hidden2"] );
-	t( "Attribute containing []", "input[name*='foo[bar]']", ["hidden2"] );
+	t("Attribute containing []", "input[name^='foo[']", ["hidden2"]);
+	t("Attribute containing []", "input[name^='foo[bar]']", ["hidden2"]);
+	t("Attribute containing []", "input[name*='[bar]']", ["hidden2"]);
+	t("Attribute containing []", "input[name$='bar]']", ["hidden2"]);
+	t("Attribute containing []", "input[name$='[bar]']", ["hidden2"]);
+	t("Attribute containing []", "input[name$='foo[bar]']", ["hidden2"]);
+	t("Attribute containing []", "input[name*='foo[bar]']", ["hidden2"]);
 
-	deepEqual( Sizzle( "input[data-comma='0,1']" ), [ document.getElementById("el12087") ], "Without context, single-quoted attribute containing ','" );
-	deepEqual( Sizzle( "input[data-comma=\"0,1\"]" ), [ document.getElementById("el12087") ], "Without context, double-quoted attribute containing ','" );
-	deepEqual( Sizzle( "input[data-comma='0,1']", document.getElementById("t12087") ), [ document.getElementById("el12087") ], "With context, single-quoted attribute containing ','" );
-	deepEqual( Sizzle( "input[data-comma=\"0,1\"]", document.getElementById("t12087") ), [ document.getElementById("el12087") ], "With context, double-quoted attribute containing ','" );
+	deepEqual(Sizzle("input[data-comma='0,1']"), [ document.getElementById("el12087") ], "Without context, single-quoted attribute containing ','");
+	deepEqual(Sizzle("input[data-comma=\"0,1\"]"), [ document.getElementById("el12087") ], "Without context, double-quoted attribute containing ','");
+	deepEqual(Sizzle("input[data-comma='0,1']", document.getElementById("t12087")), [ document.getElementById("el12087") ], "With context, single-quoted attribute containing ','");
+	deepEqual(Sizzle("input[data-comma=\"0,1\"]", document.getElementById("t12087")), [ document.getElementById("el12087") ], "With context, double-quoted attribute containing ','");
 
-	t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", ["radio1", "radio2", "hidden1"] );
-	t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", ["radio1", "radio2", "hidden1"] );
-	t( "Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", ["radio1", "radio2", "hidden1"] );
+	t("Multiple Attribute Equals", "#form input[type='radio'], #form input[type='hidden']", ["radio1", "radio2", "hidden1"]);
+	t("Multiple Attribute Equals", "#form input[type='radio'], #form input[type=\"hidden\"]", ["radio1", "radio2", "hidden1"]);
+	t("Multiple Attribute Equals", "#form input[type='radio'], #form input[type=hidden]", ["radio1", "radio2", "hidden1"]);
 
-	t( "Attribute selector using UTF8", "span[lang=中文]", ["台北"] );
+	t("Attribute selector using UTF8", "span[lang=中文]", ["台北"]);
 
-	t( "Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"] );
-	t( "Attribute Ends With", "a[href $= 'org/']", ["mark"] );
-	t( "Attribute Contains", "a[href *= 'google']", ["google","groups"] );
-	t( "Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"] );
+	t("Attribute Begins With", "a[href ^= 'http://www']", ["google","yahoo"]);
+	t("Attribute Ends With", "a[href $= 'org/']", ["mark"]);
+	t("Attribute Contains", "a[href *= 'google']", ["google","groups"]);
+	t("Attribute Is Not Equal", "#ap a[hreflang!='en']", ["google","groups","anchor1"]);
 
 	opt = document.getElementById("option1a");
 	opt.attribs.test = "";
 
-	ok( Sizzle.matchesSelector( opt, "[id*=option1][type!=checkbox]" ), "Attribute Is Not Equal Matches" );
-	ok( Sizzle.matchesSelector( opt, "[id*=option1]" ), "Attribute With No Quotes Contains Matches" );
-	ok( Sizzle.matchesSelector( opt, "[test=]" ), "Attribute With No Quotes No Content Matches" );
-	ok( !Sizzle.matchesSelector( opt, "[test^='']" ), "Attribute with empty string value does not match startsWith selector (^=)" );
-	ok( Sizzle.matchesSelector( opt, "[id=option1a]" ), "Attribute With No Quotes Equals Matches" );
-	ok( Sizzle.matchesSelector( document.getElementById("simon1"), "a[href*=#]" ), "Attribute With No Quotes Href Contains Matches" );
+	ok(Sizzle.matchesSelector(opt, "[id*=option1][type!=checkbox]"), "Attribute Is Not Equal Matches");
+	ok(Sizzle.matchesSelector(opt, "[id*=option1]"), "Attribute With No Quotes Contains Matches");
+	ok(Sizzle.matchesSelector(opt, "[test=]"), "Attribute With No Quotes No Content Matches");
+	ok(!Sizzle.matchesSelector(opt, "[test^='']"), "Attribute with empty string value does not match startsWith selector (^=)");
+	ok(Sizzle.matchesSelector(opt, "[id=option1a]"), "Attribute With No Quotes Equals Matches");
+	ok(Sizzle.matchesSelector(document.getElementById("simon1"), "a[href*=#]"), "Attribute With No Quotes Href Contains Matches");
 
-	t( "Empty values", "#select1 option[value='']", ["option1a"] );
-	t( "Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"] );
+	t("Empty values", "#select1 option[value='']", ["option1a"]);
+	t("Empty values", "#select1 option[value!='']", ["option1b","option1c","option1d"]);
 
-	t( "Select options via :selected", "#select1 option:selected", ["option1a"] );
-	t( "Select options via :selected", "#select2 option:selected", ["option2d"] );
-	t( "Select options via :selected", "#select3 option:selected", ["option3b", "option3c"] );
-	t( "Select options via :selected", "select[name='select2'] option:selected", ["option2d"] );
+	t("Select options via :selected", "#select1 option:selected", ["option1a"]);
+	t("Select options via :selected", "#select2 option:selected", ["option2d"]);
+	t("Select options via :selected", "#select3 option:selected", ["option3b", "option3c"]);
+	t("Select options via :selected", "select[name='select2'] option:selected", ["option2d"]);
 
-	t( "Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"] );
+	t("Grouped Form Elements", "input[name='foo[bar]']", ["hidden2"]);
 
 	input = document.getElementById("text1");
 	input.attribs.title = "Don't click me";
 
-	ok( Sizzle.matchesSelector( input, "input[title=\"Don't click me\"]" ), "Quote within attribute value does not mess up tokenizer" );
+	ok(Sizzle.matchesSelector(input, "input[title=\"Don't click me\"]"), "Quote within attribute value does not mess up tokenizer");
 
 	// Uncomment if the boolHook is removed
 	// var check2 = document.getElementById("check2");
@@ -572,9 +566,9 @@ test("attributes", function() {
 
 	// jQuery #12303
 	input.attribs["data-pos"] = ":first";
-	ok( Sizzle.matchesSelector( input, "input[data-pos=\\:first]"), "POS within attribute value is treated as an attribute value" );
-	ok( Sizzle.matchesSelector( input, "input[data-pos=':first']"), "POS within attribute value is treated as an attribute value" );
-	ok( Sizzle.matchesSelector( input, ":input[data-pos=':first']"), "POS within attribute value after pseudo is treated as an attribute value" );
+	ok(Sizzle.matchesSelector(input, "input[data-pos=\\:first]"), "POS within attribute value is treated as an attribute value");
+	ok(Sizzle.matchesSelector(input, "input[data-pos=':first']"), "POS within attribute value is treated as an attribute value");
+	ok(Sizzle.matchesSelector(input, ":input[data-pos=':first']"), "POS within attribute value after pseudo is treated as an attribute value");
 	delete input.attribs["data-pos"];
 
 	// Make sure attribute value quoting works correctly. See jQuery #6093; #6428; #13894
@@ -591,14 +585,14 @@ test("attributes", function() {
 		"<input type='hidden' id='attrbad_unicode' data-attr='&#x4e00;'/>"
 	).appendTo("#qunit-fixture");
 
-	t( "Underscores don't need escaping", "input[id=types_all]", ["types_all"] );
+	t("Underscores don't need escaping", "input[id=types_all]", ["types_all"]);
 
-	deepEqual( Sizzle( "input[name=foo\\ bar]", null, null, attrbad ), q("attrbad_space"),
-		"Escaped space" );
-	deepEqual( Sizzle( "input[name=foo\\.baz]", null, null, attrbad ), q("attrbad_dot"),
-		"Escaped dot" );
-	deepEqual( Sizzle( "input[name=foo\\[baz\\]]", null, null, attrbad ), q("attrbad_brackets"),
-		"Escaped brackets" );
+	deepEqual(Sizzle("input[name=foo\\ bar]", null, null, attrbad), q("attrbad_space"),
+		"Escaped space");
+	deepEqual(Sizzle("input[name=foo\\.baz]", null, null, attrbad), q("attrbad_dot"),
+		"Escaped dot");
+	deepEqual(Sizzle("input[name=foo\\[baz\\]]", null, null, attrbad), q("attrbad_brackets"),
+		"Escaped brackets");
 	//  deepEqual( Sizzle( "input[data-attr='foo_baz\\']']", null, null, attrbad ), q("attrbad_injection"),
 	//	"Escaped quote + right bracket" );
 
@@ -621,211 +615,211 @@ test("attributes", function() {
 	//	"Long numeric escape (BMP)" );*/
 	document.getElementById("attrbad_unicode").attribs["data-attr"] = "\uD834\uDF06A";
 	// It was too much code to fix Safari 5.x Supplemental Plane crashes (see ba5f09fa404379a87370ec905ffa47f8ac40aaa3)
-	deepEqual( Sizzle( "input[data-attr='\\01D306A']", null, null, attrbad ), q("attrbad_unicode"),
-		"Long numeric escape (non-BMP)" );
+	deepEqual(Sizzle("input[data-attr='\\01D306A']", null, null, attrbad), q("attrbad_unicode"),
+		"Long numeric escape (non-BMP)");
 
 	attrbad.remove();
 
-	t( "input[type=text]", "#form input[type=text]", ["text1", "text2", "hidden2", "name"] );
-	t( "input[type=search]", "#form input[type=search]", ["search"] );
-	t( "script[src] (jQuery #13777)", "#moretests script[src]", ["script-src"] );
+	t("input[type=text]", "#form input[type=text]", ["text1", "text2", "hidden2", "name"]);
+	t("input[type=search]", "#form input[type=search]", ["search"]);
+	t("script[src] (jQuery #13777)", "#moretests script[src]", ["script-src"]);
 
 	// #3279
 	div = document.createElement("div");
 	div.children = helper.getDOM("<div id='foo' xml:test='something'></div>");
 
-	deepEqual( Sizzle( "[xml\\:test]", div ), [ div.children[0] ], "Finding by attribute with escaped characters." );
+	deepEqual(Sizzle("[xml\\:test]", div), [ div.children[0] ], "Finding by attribute with escaped characters.");
 
 	div = document.getElementById("foo");
-	t( "Object.prototype property \"constructor\" (negative)", "[constructor]", [] );
-	t( "Gecko Object.prototype property \"watch\" (negative)", "[watch]", [] );
+	t("Object.prototype property \"constructor\" (negative)", "[constructor]", []);
+	t("Gecko Object.prototype property \"watch\" (negative)", "[watch]", []);
 	div.attribs.constructor = "foo";
 	div.attribs.watch = "bar";
-	t( "Object.prototype property \"constructor\"", "[constructor='foo']", ["foo"] );
-	t( "Gecko Object.prototype property \"watch\"", "[watch='bar']", ["foo"] );
+	t("Object.prototype property \"constructor\"", "[constructor='foo']", ["foo"]);
+	t("Gecko Object.prototype property \"watch\"", "[watch='bar']", ["foo"]);
 
-	t( "Value attribute is retrieved correctly", "input[value=Test]", ["text1", "text2"] );
+	t("Value attribute is retrieved correctly", "input[value=Test]", ["text1", "text2"]);
 });
 
-test("pseudo - (parent|empty)", function() {
-	expect( 3 );
-	t( "Empty", "ul:empty", ["firstUL"] );
-	t( "Empty with comment node", "ol:empty", ["empty"] );
-	t( "Is A Parent", "#qunit-fixture p:parent", ["firstp","ap","sndp","en","sap","first"] );
+test("pseudo - (parent|empty)", function(){
+	expect(3);
+	t("Empty", "ul:empty", ["firstUL"]);
+	t("Empty with comment node", "ol:empty", ["empty"]);
+	t("Is A Parent", "#qunit-fixture p:parent", ["firstp","ap","sndp","en","sap","first"]);
 });
 
-test("pseudo - (first|last|only)-(child|of-type)", function() {
-	expect( 12 );
+test("pseudo - (first|last|only)-(child|of-type)", function(){
+	expect(12);
 
-	t( "First Child", "p:first-child", ["firstp","sndp"] );
-	t( "First Child (leading id)", "#qunit-fixture p:first-child", ["firstp","sndp"] );
-	t( "First Child (leading class)", ".nothiddendiv div:first-child", ["nothiddendivchild"] );
-	t( "First Child (case-insensitive)", "#qunit-fixture p:FIRST-CHILD", ["firstp","sndp"] );
+	t("First Child", "p:first-child", ["firstp","sndp"]);
+	t("First Child (leading id)", "#qunit-fixture p:first-child", ["firstp","sndp"]);
+	t("First Child (leading class)", ".nothiddendiv div:first-child", ["nothiddendivchild"]);
+	t("First Child (case-insensitive)", "#qunit-fixture p:FIRST-CHILD", ["firstp","sndp"]);
 
-	t( "Last Child", "p:last-child", ["sap"] );
-	t( "Last Child (leading id)", "#qunit-fixture a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon","liveLink1","liveLink2"] );
+	t("Last Child", "p:last-child", ["sap"]);
+	t("Last Child (leading id)", "#qunit-fixture a:last-child", ["simon1","anchor1","mark","yahoo","anchor2","simon","liveLink1","liveLink2"]);
 
-	t( "Only Child", "#qunit-fixture a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"] );
+	t("Only Child", "#qunit-fixture a:only-child", ["simon1","anchor1","yahoo","anchor2","liveLink1","liveLink2"]);
 
-	t( "First-of-type", "#qunit-fixture > p:first-of-type", ["firstp"] );
-	t( "Last-of-type", "#qunit-fixture > p:last-of-type", ["first"] );
-	t( "Only-of-type", "#qunit-fixture > :only-of-type", ["name+value", "firstUL", "empty", "floatTest", "iframe", "table"] );
+	t("First-of-type", "#qunit-fixture > p:first-of-type", ["firstp"]);
+	t("Last-of-type", "#qunit-fixture > p:last-of-type", ["first"]);
+	t("Only-of-type", "#qunit-fixture > :only-of-type", ["name+value", "firstUL", "empty", "floatTest", "iframe", "table"]);
 
 	// Verify that the child position isn't being cached improperly
 	var secondChildren = jQuery(Sizzle("p:nth-child(2)")).before("<div></div>");
 
-	t( "No longer second child", "p:nth-child(2)", [] );
+	t("No longer second child", "p:nth-child(2)", []);
 	secondChildren.prev().remove();
-	t( "Restored second child", "p:nth-child(2)", ["ap","en"] );
+	t("Restored second child", "p:nth-child(2)", ["ap","en"]);
 });
 
-test("pseudo - nth-child", function() {
-	expect( 30 );
+test("pseudo - nth-child", function(){
+	expect(30);
 
-	t( "Nth-child", "p:nth-child(1)", ["firstp","sndp"] );
-	t( "Nth-child (with whitespace)", "p:nth-child( 1 )", ["firstp","sndp"] );
-	t( "Nth-child (case-insensitive)", "#select1 option:NTH-child(3)", ["option1c"] );
-	t( "Not nth-child", "#qunit-fixture p:not(:nth-child(1))", ["ap","en","sap","first"] );
+	t("Nth-child", "p:nth-child(1)", ["firstp","sndp"]);
+	t("Nth-child (with whitespace)", "p:nth-child( 1 )", ["firstp","sndp"]);
+	t("Nth-child (case-insensitive)", "#select1 option:NTH-child(3)", ["option1c"]);
+	t("Not nth-child", "#qunit-fixture p:not(:nth-child(1))", ["ap","en","sap","first"]);
 
-	t( "Nth-child(2)", "#qunit-fixture form#form > *:nth-child(2)", ["text1"] );
-	t( "Nth-child(2)", "#qunit-fixture form#form > :nth-child(2)", ["text1"] );
+	t("Nth-child(2)", "#qunit-fixture form#form > *:nth-child(2)", ["text1"]);
+	t("Nth-child(2)", "#qunit-fixture form#form > :nth-child(2)", ["text1"]);
 
-	t( "Nth-child(-1)", "#select1 option:nth-child(-1)", [] );
-	t( "Nth-child(3)", "#select1 option:nth-child(3)", ["option1c"] );
+	t("Nth-child(-1)", "#select1 option:nth-child(-1)", []);
+	t("Nth-child(3)", "#select1 option:nth-child(3)", ["option1c"]);
 	//  t( "Nth-child(0n+3)", "#select1 option:nth-child(0n+3)", ["option1c"] );
-	t( "Nth-child(1n+0)", "#select1 option:nth-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-child(1n)", "#select1 option:nth-child(1n)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-child(n)", "#select1 option:nth-child(n)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-child(even)", "#select1 option:nth-child(even)", ["option1b", "option1d"] );
-	t( "Nth-child(odd)", "#select1 option:nth-child(odd)", ["option1a", "option1c"] );
-	t( "Nth-child(2n)", "#select1 option:nth-child(2n)", ["option1b", "option1d"] );
-	t( "Nth-child(2n+1)", "#select1 option:nth-child(2n+1)", ["option1a", "option1c"] );
-	t( "Nth-child(2n + 1)", "#select1 option:nth-child(2n + 1)", ["option1a", "option1c"] );
-	t( "Nth-child(+2n + 1)", "#select1 option:nth-child(+2n + 1)", ["option1a", "option1c"] );
-	t( "Nth-child(3n)", "#select1 option:nth-child(3n)", ["option1c"] );
-	t( "Nth-child(3n+1)", "#select1 option:nth-child(3n+1)", ["option1a", "option1d"] );
-	t( "Nth-child(3n+2)", "#select1 option:nth-child(3n+2)", ["option1b"] );
-	t( "Nth-child(3n+3)", "#select1 option:nth-child(3n+3)", ["option1c"] );
-	t( "Nth-child(3n-1)", "#select1 option:nth-child(3n-1)", ["option1b"] );
-	t( "Nth-child(3n-2)", "#select1 option:nth-child(3n-2)", ["option1a", "option1d"] );
-	t( "Nth-child(3n-3)", "#select1 option:nth-child(3n-3)", ["option1c"] );
-	t( "Nth-child(3n+0)", "#select1 option:nth-child(3n+0)", ["option1c"] );
-	t( "Nth-child(-1n+3)", "#select1 option:nth-child(-1n+3)", ["option1a", "option1b", "option1c"] );
-	t( "Nth-child(-n+3)", "#select1 option:nth-child(-n+3)", ["option1a", "option1b", "option1c"] );
-	t( "Nth-child(-1n + 3)", "#select1 option:nth-child(-1n + 3)", ["option1a", "option1b", "option1c"] );
+	t("Nth-child(1n+0)", "#select1 option:nth-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-child(1n)", "#select1 option:nth-child(1n)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-child(n)", "#select1 option:nth-child(n)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-child(even)", "#select1 option:nth-child(even)", ["option1b", "option1d"]);
+	t("Nth-child(odd)", "#select1 option:nth-child(odd)", ["option1a", "option1c"]);
+	t("Nth-child(2n)", "#select1 option:nth-child(2n)", ["option1b", "option1d"]);
+	t("Nth-child(2n+1)", "#select1 option:nth-child(2n+1)", ["option1a", "option1c"]);
+	t("Nth-child(2n + 1)", "#select1 option:nth-child(2n + 1)", ["option1a", "option1c"]);
+	t("Nth-child(+2n + 1)", "#select1 option:nth-child(+2n + 1)", ["option1a", "option1c"]);
+	t("Nth-child(3n)", "#select1 option:nth-child(3n)", ["option1c"]);
+	t("Nth-child(3n+1)", "#select1 option:nth-child(3n+1)", ["option1a", "option1d"]);
+	t("Nth-child(3n+2)", "#select1 option:nth-child(3n+2)", ["option1b"]);
+	t("Nth-child(3n+3)", "#select1 option:nth-child(3n+3)", ["option1c"]);
+	t("Nth-child(3n-1)", "#select1 option:nth-child(3n-1)", ["option1b"]);
+	t("Nth-child(3n-2)", "#select1 option:nth-child(3n-2)", ["option1a", "option1d"]);
+	t("Nth-child(3n-3)", "#select1 option:nth-child(3n-3)", ["option1c"]);
+	t("Nth-child(3n+0)", "#select1 option:nth-child(3n+0)", ["option1c"]);
+	t("Nth-child(-1n+3)", "#select1 option:nth-child(-1n+3)", ["option1a", "option1b", "option1c"]);
+	t("Nth-child(-n+3)", "#select1 option:nth-child(-n+3)", ["option1a", "option1b", "option1c"]);
+	t("Nth-child(-1n + 3)", "#select1 option:nth-child(-1n + 3)", ["option1a", "option1b", "option1c"]);
 
 	//  deepEqual( Sizzle( ":nth-child(n)", null, null, [ document.createElement("a") ].concat( q("ap") ) ), q("ap"), "Seeded nth-child" );
 });
 
-test("pseudo - nth-last-child", function() {
-	expect( 30 );
+test("pseudo - nth-last-child", function(){
+	expect(30);
 
-	t( "Nth-last-child", "form:nth-last-child(5)", ["testForm"] );
-	t( "Nth-last-child (with whitespace)", "form:nth-last-child( 5 )", ["testForm"] );
-	t( "Nth-last-child (case-insensitive)", "#select1 option:NTH-last-child(3)", ["option1b"] );
-	t( "Not nth-last-child", "#qunit-fixture p:not(:nth-last-child(1))", ["firstp", "ap", "sndp", "en", "first"] );
+	t("Nth-last-child", "form:nth-last-child(5)", ["testForm"]);
+	t("Nth-last-child (with whitespace)", "form:nth-last-child( 5 )", ["testForm"]);
+	t("Nth-last-child (case-insensitive)", "#select1 option:NTH-last-child(3)", ["option1b"]);
+	t("Not nth-last-child", "#qunit-fixture p:not(:nth-last-child(1))", ["firstp", "ap", "sndp", "en", "first"]);
 
-	t( "Nth-last-child(-1)", "#select1 option:nth-last-child(-1)", [] );
-	t( "Nth-last-child(3)", "#select1 :nth-last-child(3)", ["option1b"] );
-	t( "Nth-last-child(3)", "#select1 *:nth-last-child(3)", ["option1b"] );
-	t( "Nth-last-child(3)", "#select1 option:nth-last-child(3)", ["option1b"] );
+	t("Nth-last-child(-1)", "#select1 option:nth-last-child(-1)", []);
+	t("Nth-last-child(3)", "#select1 :nth-last-child(3)", ["option1b"]);
+	t("Nth-last-child(3)", "#select1 *:nth-last-child(3)", ["option1b"]);
+	t("Nth-last-child(3)", "#select1 option:nth-last-child(3)", ["option1b"]);
 	//  t( "Nth-last-child(0n+3)", "#select1 option:nth-last-child(0n+3)", ["option1b"] );
-	t( "Nth-last-child(1n+0)", "#select1 option:nth-last-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-last-child(1n)", "#select1 option:nth-last-child(1n)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-last-child(n)", "#select1 option:nth-last-child(n)", ["option1a", "option1b", "option1c", "option1d"] );
-	t( "Nth-last-child(even)", "#select1 option:nth-last-child(even)", ["option1a", "option1c"] );
-	t( "Nth-last-child(odd)", "#select1 option:nth-last-child(odd)", ["option1b", "option1d"] );
-	t( "Nth-last-child(2n)", "#select1 option:nth-last-child(2n)", ["option1a", "option1c"] );
-	t( "Nth-last-child(2n+1)", "#select1 option:nth-last-child(2n+1)", ["option1b", "option1d"] );
-	t( "Nth-last-child(2n + 1)", "#select1 option:nth-last-child(2n + 1)", ["option1b", "option1d"] );
-	t( "Nth-last-child(+2n + 1)", "#select1 option:nth-last-child(+2n + 1)", ["option1b", "option1d"] );
-	t( "Nth-last-child(3n)", "#select1 option:nth-last-child(3n)", ["option1b"] );
-	t( "Nth-last-child(3n+1)", "#select1 option:nth-last-child(3n+1)", ["option1a", "option1d"] );
-	t( "Nth-last-child(3n+2)", "#select1 option:nth-last-child(3n+2)", ["option1c"] );
-	t( "Nth-last-child(3n+3)", "#select1 option:nth-last-child(3n+3)", ["option1b"] );
-	t( "Nth-last-child(3n-1)", "#select1 option:nth-last-child(3n-1)", ["option1c"] );
-	t( "Nth-last-child(3n-2)", "#select1 option:nth-last-child(3n-2)", ["option1a", "option1d"] );
-	t( "Nth-last-child(3n-3)", "#select1 option:nth-last-child(3n-3)", ["option1b"] );
-	t( "Nth-last-child(3n+0)", "#select1 option:nth-last-child(3n+0)", ["option1b"] );
-	t( "Nth-last-child(-1n+3)", "#select1 option:nth-last-child(-1n+3)", ["option1b", "option1c", "option1d"] );
-	t( "Nth-last-child(-n+3)", "#select1 option:nth-last-child(-n+3)", ["option1b", "option1c", "option1d"] );
-	t( "Nth-last-child(-1n + 3)", "#select1 option:nth-last-child(-1n + 3)", ["option1b", "option1c", "option1d"] );
+	t("Nth-last-child(1n+0)", "#select1 option:nth-last-child(1n+0)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-last-child(1n)", "#select1 option:nth-last-child(1n)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-last-child(n)", "#select1 option:nth-last-child(n)", ["option1a", "option1b", "option1c", "option1d"]);
+	t("Nth-last-child(even)", "#select1 option:nth-last-child(even)", ["option1a", "option1c"]);
+	t("Nth-last-child(odd)", "#select1 option:nth-last-child(odd)", ["option1b", "option1d"]);
+	t("Nth-last-child(2n)", "#select1 option:nth-last-child(2n)", ["option1a", "option1c"]);
+	t("Nth-last-child(2n+1)", "#select1 option:nth-last-child(2n+1)", ["option1b", "option1d"]);
+	t("Nth-last-child(2n + 1)", "#select1 option:nth-last-child(2n + 1)", ["option1b", "option1d"]);
+	t("Nth-last-child(+2n + 1)", "#select1 option:nth-last-child(+2n + 1)", ["option1b", "option1d"]);
+	t("Nth-last-child(3n)", "#select1 option:nth-last-child(3n)", ["option1b"]);
+	t("Nth-last-child(3n+1)", "#select1 option:nth-last-child(3n+1)", ["option1a", "option1d"]);
+	t("Nth-last-child(3n+2)", "#select1 option:nth-last-child(3n+2)", ["option1c"]);
+	t("Nth-last-child(3n+3)", "#select1 option:nth-last-child(3n+3)", ["option1b"]);
+	t("Nth-last-child(3n-1)", "#select1 option:nth-last-child(3n-1)", ["option1c"]);
+	t("Nth-last-child(3n-2)", "#select1 option:nth-last-child(3n-2)", ["option1a", "option1d"]);
+	t("Nth-last-child(3n-3)", "#select1 option:nth-last-child(3n-3)", ["option1b"]);
+	t("Nth-last-child(3n+0)", "#select1 option:nth-last-child(3n+0)", ["option1b"]);
+	t("Nth-last-child(-1n+3)", "#select1 option:nth-last-child(-1n+3)", ["option1b", "option1c", "option1d"]);
+	t("Nth-last-child(-n+3)", "#select1 option:nth-last-child(-n+3)", ["option1b", "option1c", "option1d"]);
+	t("Nth-last-child(-1n + 3)", "#select1 option:nth-last-child(-1n + 3)", ["option1b", "option1c", "option1d"]);
 
 	//  deepEqual( Sizzle( ":nth-last-child(n)", null, null, [ document.createElement("a") ].concat( q("ap") ) ), q("ap"), "Seeded nth-last-child" );
 });
 
-test("pseudo - nth-of-type", function() {
-	expect( 9 );
-	t( "Nth-of-type(-1)", ":nth-of-type(-1)", [] );
-	t( "Nth-of-type(3)", "#ap :nth-of-type(3)", ["mark"] );
-	t( "Nth-of-type(n)", "#ap :nth-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"] );
-	t( "Nth-of-type(0n+3)", "#ap :nth-of-type(0n+3)", ["mark"] );
-	t( "Nth-of-type(2n)", "#ap :nth-of-type(2n)", ["groups"] );
-	t( "Nth-of-type(even)", "#ap :nth-of-type(even)", ["groups"] );
-	t( "Nth-of-type(2n+1)", "#ap :nth-of-type(2n+1)", ["google", "code1", "anchor1", "mark"] );
-	t( "Nth-of-type(odd)", "#ap :nth-of-type(odd)", ["google", "code1", "anchor1", "mark"] );
-	t( "Nth-of-type(-n+2)", "#qunit-fixture > :nth-of-type(-n+2)", ["firstp", "ap", "foo", "nothiddendiv", "name+value", "firstUL", "empty", "form", "floatTest", "iframe", "lengthtest", "table"] );
+test("pseudo - nth-of-type", function(){
+	expect(9);
+	t("Nth-of-type(-1)", ":nth-of-type(-1)", []);
+	t("Nth-of-type(3)", "#ap :nth-of-type(3)", ["mark"]);
+	t("Nth-of-type(n)", "#ap :nth-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"]);
+	t("Nth-of-type(0n+3)", "#ap :nth-of-type(0n+3)", ["mark"]);
+	t("Nth-of-type(2n)", "#ap :nth-of-type(2n)", ["groups"]);
+	t("Nth-of-type(even)", "#ap :nth-of-type(even)", ["groups"]);
+	t("Nth-of-type(2n+1)", "#ap :nth-of-type(2n+1)", ["google", "code1", "anchor1", "mark"]);
+	t("Nth-of-type(odd)", "#ap :nth-of-type(odd)", ["google", "code1", "anchor1", "mark"]);
+	t("Nth-of-type(-n+2)", "#qunit-fixture > :nth-of-type(-n+2)", ["firstp", "ap", "foo", "nothiddendiv", "name+value", "firstUL", "empty", "form", "floatTest", "iframe", "lengthtest", "table"]);
 });
 
-test("pseudo - nth-last-of-type", function() {
-	expect( 9 );
-	t( "Nth-last-of-type(-1)", ":nth-last-of-type(-1)", [] );
-	t( "Nth-last-of-type(3)", "#ap :nth-last-of-type(3)", ["google"] );
-	t( "Nth-last-of-type(n)", "#ap :nth-last-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"] );
-	t( "Nth-last-of-type(0n+3)", "#ap :nth-last-of-type(0n+3)", ["google"] );
-	t( "Nth-last-of-type(2n)", "#ap :nth-last-of-type(2n)", ["groups"] );
-	t( "Nth-last-of-type(even)", "#ap :nth-last-of-type(even)", ["groups"] );
-	t( "Nth-last-of-type(2n+1)", "#ap :nth-last-of-type(2n+1)", ["google", "code1", "anchor1", "mark"] );
-	t( "Nth-last-of-type(odd)", "#ap :nth-last-of-type(odd)", ["google", "code1", "anchor1", "mark"] );
-	t( "Nth-last-of-type(-n+2)", "#qunit-fixture > :nth-last-of-type(-n+2)", ["ap", "name+value", "first", "firstUL", "empty", "floatTest", "iframe", "table", "name-tests", "testForm", "liveHandlerOrder", "siblingTest"] );
+test("pseudo - nth-last-of-type", function(){
+	expect(9);
+	t("Nth-last-of-type(-1)", ":nth-last-of-type(-1)", []);
+	t("Nth-last-of-type(3)", "#ap :nth-last-of-type(3)", ["google"]);
+	t("Nth-last-of-type(n)", "#ap :nth-last-of-type(n)", ["google", "groups", "code1", "anchor1", "mark"]);
+	t("Nth-last-of-type(0n+3)", "#ap :nth-last-of-type(0n+3)", ["google"]);
+	t("Nth-last-of-type(2n)", "#ap :nth-last-of-type(2n)", ["groups"]);
+	t("Nth-last-of-type(even)", "#ap :nth-last-of-type(even)", ["groups"]);
+	t("Nth-last-of-type(2n+1)", "#ap :nth-last-of-type(2n+1)", ["google", "code1", "anchor1", "mark"]);
+	t("Nth-last-of-type(odd)", "#ap :nth-last-of-type(odd)", ["google", "code1", "anchor1", "mark"]);
+	t("Nth-last-of-type(-n+2)", "#qunit-fixture > :nth-last-of-type(-n+2)", ["ap", "name+value", "first", "firstUL", "empty", "floatTest", "iframe", "table", "name-tests", "testForm", "liveHandlerOrder", "siblingTest"]);
 });
 
-test("pseudo - has", function() {
-	expect( 3 );
+test("pseudo - has", function(){
+	expect(3);
 
-	t( "Basic test", "p:has(a)", ["firstp","ap","en","sap"] );
-	t( "Basic test (irrelevant whitespace)", "p:has( a )", ["firstp","ap","en","sap"] );
-	t( "Nested with overlapping candidates", "#qunit-fixture div:has(div:has(div:not([id])))", [ "moretests", "t2037" ] );
+	t("Basic test", "p:has(a)", ["firstp","ap","en","sap"]);
+	t("Basic test (irrelevant whitespace)", "p:has( a )", ["firstp","ap","en","sap"]);
+	t("Nested with overlapping candidates", "#qunit-fixture div:has(div:has(div:not([id])))", [ "moretests", "t2037" ]);
 });
 
-test("pseudo - misc", function() {
-	expect( 39 );
+test("pseudo - misc", function(){
+	expect(39);
 
 	var select, tmp, input;
 
-	t( "Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
-	t( "Headers(case-insensitive)", ":Header", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
-	t( "Multiple matches with the same context (cache check)", "#form select:has(option:first-child:contains('o'))", ["select1", "select2", "select3", "select4"] );
+	t("Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"]);
+	t("Headers(case-insensitive)", ":Header", ["qunit-header", "qunit-banner", "qunit-userAgent"]);
+	t("Multiple matches with the same context (cache check)", "#form select:has(option:first-child:contains('o'))", ["select1", "select2", "select3", "select4"]);
 
-	ok( Sizzle("#qunit-fixture :not(:has(:has(*)))").length, "All not grandparents" );
+	ok(Sizzle("#qunit-fixture :not(:has(:has(*)))").length, "All not grandparents");
 
 	select = document.getElementById("select1");
-	ok( Sizzle.matchesSelector( select, ":has(option)" ), "Has Option Matches" );
+	ok(Sizzle.matchesSelector(select, ":has(option)"), "Has Option Matches");
 
-	ok( Sizzle("a:contains('')").length, "Empty string contains" );
-	t( "Text Contains", "a:contains(Google)", ["google","groups"] );
-	t( "Text Contains", "a:contains(Google Groups)", ["groups"] );
+	ok(Sizzle("a:contains('')").length, "Empty string contains");
+	t("Text Contains", "a:contains(Google)", ["google","groups"]);
+	t("Text Contains", "a:contains(Google Groups)", ["groups"]);
 
-	t( "Text Contains", "a:contains('Google Groups (Link)')", ["groups"] );
-	t( "Text Contains", "a:contains(\"(Link)\")", ["groups"] );
-	t( "Text Contains", "a:contains(Google Groups (Link))", ["groups"] );
-	t( "Text Contains", "a:contains((Link))", ["groups"] );
+	t("Text Contains", "a:contains('Google Groups (Link)')", ["groups"]);
+	t("Text Contains", "a:contains(\"(Link)\")", ["groups"]);
+	t("Text Contains", "a:contains(Google Groups (Link))", ["groups"]);
+	t("Text Contains", "a:contains((Link))", ["groups"]);
 
 
 	tmp = document.createElement("div");
 	tmp.attribs.id = "tmp_input";
-	document.body.children.push( tmp );
+	document.body.children.push(tmp);
 
-	[ "button", "submit", "reset" ].forEach(function( type ) {
+	[ "button", "submit", "reset" ].forEach(function(type){
 		var els = jQuery(
 			"<input id='input_%' type='%'/><button id='button_%' type='%'>test</button>"
-			.replace( /%/g, type )
-		).appendTo( tmp );
+			.replace(/%/g, type)
+		).appendTo(tmp);
 
-		t( "Input Buttons :" + type, "#tmp_input :" + type, [ "input_" + type, "button_" + type ] );
+		t("Input Buttons :" + type, "#tmp_input :" + type, [ "input_" + type, "button_" + type ]);
 
-		ok( Sizzle.matchesSelector( els[0], ":" + type ), "Input Matches :" + type );
-		ok( Sizzle.matchesSelector( els[1], ":" + type ), "Button Matches :" + type );
+		ok(Sizzle.matchesSelector(els[0], ":" + type), "Input Matches :" + type);
+		ok(Sizzle.matchesSelector(els[1], ":" + type), "Button Matches :" + type);
 	});
 
 	document.body.children.pop();
@@ -836,16 +830,16 @@ test("pseudo - misc", function() {
 	tmp.children = helper.getDOM("<span>Hello I am focusable.</span>");
 	// Setting tabIndex should make the element focusable
 	// http://dev.w3.org/html5/spec/single-page.html#focus-management
-	document.body.children.push( tmp );
+	document.body.children.push(tmp);
 	tmp.tabIndex = 0;
 	//tmp.focus();
-	if ( document.activeElement !== tmp || (document.hasFocus && !document.hasFocus()) ||
-		(document.querySelectorAll && !document.querySelectorAll("div:focus").length) ) {
-		ok( true, "The div was not focused. Skip checking the :focus match." );
-		ok( true, "The div was not focused. Skip checking the :focus match." );
+	if(document.activeElement !== tmp || (document.hasFocus && !document.hasFocus()) ||
+		(document.querySelectorAll && !document.querySelectorAll("div:focus").length)){
+		ok(true, "The div was not focused. Skip checking the :focus match.");
+		ok(true, "The div was not focused. Skip checking the :focus match.");
 	} else {
-		t( "tabIndex element focused", ":focus", [ "tmp_input" ] );
-		ok( Sizzle.matchesSelector( tmp, ":focus" ), ":focus matches tabIndex div" );
+		t("tabIndex element focused", ":focus", [ "tmp_input" ]);
+		ok(Sizzle.matchesSelector(tmp, ":focus"), ":focus matches tabIndex div");
 	}
 
 	// Blur tmp
@@ -859,23 +853,23 @@ test("pseudo - misc", function() {
 	input.attribs.type = "text";
 	input.attribs.id = "focus-input";
 
-	document.body.children.push( input );
+	document.body.children.push(input);
 	//input.focus();
 
 	// Inputs can't be focused unless the document has focus
-	if ( document.activeElement !== input || (document.hasFocus && !document.hasFocus()) ||
-		(document.querySelectorAll && !document.querySelectorAll("input:focus").length) ) {
-		ok( true, "The input was not focused. Skip checking the :focus match." );
-		ok( true, "The input was not focused. Skip checking the :focus match." );
+	if(document.activeElement !== input || (document.hasFocus && !document.hasFocus()) ||
+		(document.querySelectorAll && !document.querySelectorAll("input:focus").length)){
+		ok(true, "The input was not focused. Skip checking the :focus match.");
+		ok(true, "The input was not focused. Skip checking the :focus match.");
 	} else {
-		t( "Element focused", "input:focus", [ "focus-input" ] );
-		ok( Sizzle.matchesSelector( input, ":focus" ), ":focus matches" );
+		t("Element focused", "input:focus", [ "focus-input" ]);
+		ok(Sizzle.matchesSelector(input, ":focus"), ":focus matches");
 	}
 
 	//input.blur();
 
 	// When IE is out of focus, blur does not work. Force it here.
-	if ( document.activeElement === input ) {
+	if(document.activeElement === input){
 		document.body.focus();
 	}
 
@@ -885,72 +879,72 @@ test("pseudo - misc", function() {
 
 
 	deepEqual(
-		Sizzle( "[id='select1'] *:not(:last-child), [id='select2'] *:not(:last-child)", q("qunit-fixture")[0] ),
-		q( "option1a", "option1b", "option1c", "option2a", "option2b", "option2c" ),
+		Sizzle("[id='select1'] *:not(:last-child), [id='select2'] *:not(:last-child)", q("qunit-fixture")[0]),
+		q("option1a", "option1b", "option1c", "option2a", "option2b", "option2c"),
 		"caching system tolerates recursive selection"
 	);
 
 	// Tokenization edge cases
-	t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code)", ["ap"] );
-	t( "Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code):contains(This link)", ["ap"] );
+	t("Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code)", ["ap"]);
+	t("Sequential pseudos", "#qunit-fixture p:has(:contains(mark)):has(code):contains(This link)", ["ap"]);
 
-	t( "Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"] );
-	t( "Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"] );
-	t( "Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=\\)]", ["sndp"] );
-	t( "Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=')']", ["sndp"] );
+	t("Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"]);
+	t("Pseudo argument containing ')'", "p:has(>a.GROUPS[src!=')'])", ["ap"]);
+	t("Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=\\)]", ["sndp"]);
+	t("Pseudo followed by token containing ')'", "p:contains(id=\"foo\")[id!=')']", ["sndp"]);
 
-	t( "Multi-pseudo", "#ap:has(*), #ap:has(*)", ["ap"] );
+	t("Multi-pseudo", "#ap:has(*), #ap:has(*)", ["ap"]);
 	//t( "Multi-positional", "#ap:gt(0), #ap:lt(1)", ["ap"] );
-	t( "Multi-pseudo with leading nonexistent id", "#nonexistent:has(*), #ap:has(*)", ["ap"] );
+	t("Multi-pseudo with leading nonexistent id", "#nonexistent:has(*), #ap:has(*)", ["ap"]);
 	//t( "Multi-positional with leading nonexistent id", "#nonexistent:gt(0), #ap:lt(1)", ["ap"] );
 
-	t( "Tokenization stressor", "a[class*=blog]:not(:has(*, :contains(!)), :contains(!)), br:contains(]), p:contains(]), :not(:empty):not(:parent)", ["ap", "mark","yahoo","simon"] );
+	t("Tokenization stressor", "a[class*=blog]:not(:has(*, :contains(!)), :contains(!)), br:contains(]), p:contains(]), :not(:empty):not(:parent)", ["ap", "mark","yahoo","simon"]);
 });
 
 
-test("pseudo - :not", function() {
-	expect( 43 );
+test("pseudo - :not", function(){
+	expect(43);
 
-	t( "Not", "a.blog:not(.link)", ["mark"] );
+	t("Not", "a.blog:not(.link)", ["mark"]);
 	//t( ":not() with :first", "#foo p:not(:first) .link", ["simon"] );
 
-	t( "Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e", "option4e", "option5b", "option5c"] );
-	t( "Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"] );
-
-	t( ":not() failing interior", "#qunit-fixture p:not(.foo)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not() failing interior", "#qunit-fixture p:not(div.foo)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not() failing interior", "#qunit-fixture p:not(p.foo)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not() failing interior", "#qunit-fixture p:not(#blargh)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not() failing interior", "#qunit-fixture p:not(div#blargh)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not() failing interior", "#qunit-fixture p:not(p#blargh)", ["firstp","ap","sndp","en","sap","first"] );
-
-	t( ":not Multiple", "#qunit-fixture p:not(a)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not Multiple", "#qunit-fixture p:not( a )", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not Multiple", "#qunit-fixture p:not( p )", [] );
-	t( ":not Multiple", "#qunit-fixture p:not(a, b)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not Multiple", "#qunit-fixture p:not(a, b, div)", ["firstp","ap","sndp","en","sap","first"] );
-	t( ":not Multiple", "p:not(p)", [] );
-	t( ":not Multiple", "p:not(a,p)", [] );
-	t( ":not Multiple", "p:not(p,a)", [] );
-	t( ":not Multiple", "p:not(a,p,b)", [] );
-	t( ":not Multiple", ":input:not(:image,:input,:submit)", [] );
-	t( ":not Multiple", "#qunit-fixture p:not(:has(a), :nth-child(1))", ["first"] );
-
-	t( "No element not selector", ".container div:not(.excluded) div", [] );
-
-	t( ":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2", "select5"]);
-	t( ":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3", "select4","select5"]);
-	t( ":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3", "select4", "select5"]);
-
-	t( ":not() Multiple Class", "#foo a:not(.blog)", ["yahoo", "anchor2"] );
-	t( ":not() Multiple Class", "#foo a:not(.link)", ["yahoo", "anchor2"] );
-	t( ":not() Multiple Class", "#foo a:not(.blog.link)", ["yahoo", "anchor2"] );
-
-	t( ":not chaining (compound)", "#qunit-fixture div[id]:not(:has(div, span)):not(:has(*))", ["nothiddendivchild", "divWithNoTabIndex"] );
-	t( ":not chaining (with attribute)", "#qunit-fixture form[id]:not([action$='formaction']):not(:button)", ["lengthtest", "name-tests", "testForm"] );
-	t( ":not chaining (colon in attribute)", "#qunit-fixture form[id]:not([action='form:action']):not(:button)", ["form", "lengthtest", "name-tests", "testForm"] );
-	t( ":not chaining (colon in attribute and nested chaining)", "#qunit-fixture form[id]:not([action='form:action']:button):not(:input)", ["form", "lengthtest", "name-tests", "testForm"] );
-	t( ":not chaining", "#form select:not(.select1):contains(Nothing) > option:not(option)", [] );
+	t("Not - multiple", "#form option:not(:contains(Nothing),#option1b,:selected)", ["option1c", "option1d", "option2b", "option2c", "option3d", "option3e", "option4e", "option5b", "option5c"]);
+	t("Not - recursive", "#form option:not(:not(:selected))[id^='option3']", [ "option3b", "option3c"]);
+
+	t(":not() failing interior", "#qunit-fixture p:not(.foo)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not() failing interior", "#qunit-fixture p:not(div.foo)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not() failing interior", "#qunit-fixture p:not(p.foo)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not() failing interior", "#qunit-fixture p:not(#blargh)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not() failing interior", "#qunit-fixture p:not(div#blargh)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not() failing interior", "#qunit-fixture p:not(p#blargh)", ["firstp","ap","sndp","en","sap","first"]);
+
+	t(":not Multiple", "#qunit-fixture p:not(a)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not Multiple", "#qunit-fixture p:not( a )", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not Multiple", "#qunit-fixture p:not( p )", []);
+	t(":not Multiple", "#qunit-fixture p:not(a, b)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not Multiple", "#qunit-fixture p:not(a, b, div)", ["firstp","ap","sndp","en","sap","first"]);
+	t(":not Multiple", "p:not(p)", []);
+	t(":not Multiple", "p:not(a,p)", []);
+	t(":not Multiple", "p:not(p,a)", []);
+	t(":not Multiple", "p:not(a,p,b)", []);
+	t(":not Multiple", ":input:not(:image,:input,:submit)", []);
+	t(":not Multiple", "#qunit-fixture p:not(:has(a), :nth-child(1))", ["first"]);
+
+	t("No element not selector", ".container div:not(.excluded) div", []);
+
+	t(":not() Existing attribute", "#form select:not([multiple])", ["select1", "select2", "select5"]);
+	t(":not() Equals attribute", "#form select:not([name=select1])", ["select2", "select3", "select4","select5"]);
+	t(":not() Equals quoted attribute", "#form select:not([name='select1'])", ["select2", "select3", "select4", "select5"]);
+
+	t(":not() Multiple Class", "#foo a:not(.blog)", ["yahoo", "anchor2"]);
+	t(":not() Multiple Class", "#foo a:not(.link)", ["yahoo", "anchor2"]);
+	t(":not() Multiple Class", "#foo a:not(.blog.link)", ["yahoo", "anchor2"]);
+
+	t(":not chaining (compound)", "#qunit-fixture div[id]:not(:has(div, span)):not(:has(*))", ["nothiddendivchild", "divWithNoTabIndex"]);
+	t(":not chaining (with attribute)", "#qunit-fixture form[id]:not([action$='formaction']):not(:button)", ["lengthtest", "name-tests", "testForm"]);
+	t(":not chaining (colon in attribute)", "#qunit-fixture form[id]:not([action='form:action']):not(:button)", ["form", "lengthtest", "name-tests", "testForm"]);
+	t(":not chaining (colon in attribute and nested chaining)", "#qunit-fixture form[id]:not([action='form:action']:button):not(:input)", ["form", "lengthtest", "name-tests", "testForm"]);
+	t(":not chaining", "#form select:not(.select1):contains(Nothing) > option:not(option)", []);
 
 	/*
 	t( "positional :not()", "#foo p:not(:last)", ["sndp", "en"] );
@@ -1015,28 +1009,28 @@ test("pseudo - position", function() {
 });
 */
 
-test("pseudo - form", function() {
-	expect( 10 );
+test("pseudo - form", function(){
+	expect(10);
 
 	var extraTexts = jQuery("<input id=\"impliedText\"/><input id=\"capitalText\" type=\"TEXT\">").appendTo("#form");
 
-	t( "Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3", "select4", "select5", "impliedText", "capitalText"] );
-	t( "Form element :radio", "#form :radio", ["radio1", "radio2"] );
-	t( "Form element :checkbox", "#form :checkbox", ["check1", "check2"] );
-	t( "Form element :text", "#form :text", ["text1", "text2", "hidden2", "name", "impliedText", "capitalText"] );
-	t( "Form element :radio:checked", "#form :radio:checked", ["radio2"] );
-	t( "Form element :checkbox:checked", "#form :checkbox:checked", ["check1"] );
-	t( "Form element :radio:checked, :checkbox:checked", "#form :radio:checked, #form :checkbox:checked", ["radio2", "check1"] );
+	t("Form element :input", "#form :input", ["text1", "text2", "radio1", "radio2", "check1", "check2", "hidden1", "hidden2", "name", "search", "button", "area1", "select1", "select2", "select3", "select4", "select5", "impliedText", "capitalText"]);
+	t("Form element :radio", "#form :radio", ["radio1", "radio2"]);
+	t("Form element :checkbox", "#form :checkbox", ["check1", "check2"]);
+	t("Form element :text", "#form :text", ["text1", "text2", "hidden2", "name", "impliedText", "capitalText"]);
+	t("Form element :radio:checked", "#form :radio:checked", ["radio2"]);
+	t("Form element :checkbox:checked", "#form :checkbox:checked", ["check1"]);
+	t("Form element :radio:checked, :checkbox:checked", "#form :radio:checked, #form :checkbox:checked", ["radio2", "check1"]);
 
-	t( "Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"] );
-	t( "Selected Option Element are also :checked", "#form option:checked", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"] );
-	t( "Hidden inputs should be treated as enabled. See QSA test.", "#hidden1:enabled", ["hidden1"] );
+	t("Selected Option Element", "#form option:selected", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"]);
+	t("Selected Option Element are also :checked", "#form option:checked", ["option1a","option2d","option3b","option3c","option4b","option4c","option4d","option5a"]);
+	t("Hidden inputs should be treated as enabled. See QSA test.", "#hidden1:enabled", ["hidden1"]);
 
 	extraTexts.remove();
 });
 
-test("pseudo - :target and :root", function() {
-	expect( 2 );
+test("pseudo - :target and :root", function(){
+	expect(2);
 	/* // TODO add shim from qwery tests
 	// Target
 	var oldHash,
@@ -1054,7 +1048,7 @@ test("pseudo - :target and :root", function() {
 	window.location.hash = oldHash;*/
 
 	// Root
-	equal( Sizzle(":root")[0], document.documentElement, ":root selector" );
+	equal(Sizzle(":root")[0], document.documentElement, ":root selector");
 });
 
 /*
@@ -1159,10 +1153,10 @@ test("pseudo - :lang", function() {
 });
 */
 
-test("caching", function() {
-	expect( 1 );
-	Sizzle( ":not(code)", document.getElementById("ap") );
-	deepEqual( Sizzle( ":not(code)", document.getElementById("foo") ), q("sndp", "en", "yahoo", "sap", "anchor2", "simon"), "Reusing selector with new context" );
+test("caching", function(){
+	expect(1);
+	Sizzle(":not(code)", document.getElementById("ap"));
+	deepEqual(Sizzle(":not(code)", document.getElementById("foo")), q("sndp", "en", "yahoo", "sap", "anchor2", "simon"), "Reusing selector with new context");
 });
 /*
 asyncTest( "Iframe dispatch should not affect Sizzle, see jQuery #13936", 1, function() {
diff --git a/test/test.js b/test/test.js
index 99a486d..c3324bd 100644
--- a/test/test.js
+++ b/test/test.js
@@ -14,9 +14,11 @@ describe("qwery", function(){
 
 function exportsRun(mod){
 	Object.keys(mod).forEach(function(name){
-		if(typeof mod[name] === "object") describe(name, function(){
+		if(typeof mod[name] === "object"){
+			describe(name, function(){
 				exportsRun(mod[name]);
 			});
+		}
 		else it(name, mod[name]);
 	});
 }
\ No newline at end of file
diff --git a/test/tools/bench.js b/test/tools/bench.js
index ef251b1..b834cc7 100644
--- a/test/tools/bench.js
+++ b/test/tools/bench.js
@@ -7,4 +7,4 @@ var ben = require("ben"),
 
 //console.log("Parsing took:", ben(1e5, function(){compile(testString);}));
 var compiled = compile(testString);
-console.log("Executing took:", ben(1e6, function(){CSSselect(compiled, dom);})*1e3);
\ No newline at end of file
+console.log("Executing took:", ben(1e6, function(){CSSselect(compiled, dom);}) * 1e3);
\ No newline at end of file
diff --git a/test/tools/helper.js b/test/tools/helper.js
index 0b08e98..99278ba 100644
--- a/test/tools/helper.js
+++ b/test/tools/helper.js
@@ -1,8 +1,8 @@
 var fs = require("fs"),
-    path = require("path"),
-    htmlparser2 = require("htmlparser2"),
-    DomUtils = htmlparser2.DomUtils,
-    CSSselect = require("../../");
+	path = require("path"),
+	htmlparser2 = require("htmlparser2"),
+	DomUtils = htmlparser2.DomUtils,
+	CSSselect = require("../../");
 
 function getDOMFromPath(path, options){
 	return htmlparser2.parseDOM(fs.readFileSync(path).toString(), options);
@@ -24,7 +24,7 @@ module.exports = {
 		var document = getDOMFromPath(path);
 
 		document.getElementsByTagName = function(name){
-			return DomUtils.getElementsByTagName("*", document);
+			return DomUtils.getElementsByTagName(name || "*", document);
 		};
 		document.getElementById = function(id){
 			return DomUtils.getElementById(id, document);
@@ -32,7 +32,7 @@ module.exports = {
 		document.createTextNode = function(content){
 			return {
 				type: "text",
-				data: "content"
+				data: content
 			};
 		};
 		document.createElement = function(name){
@@ -48,4 +48,4 @@ module.exports = {
 
 		return document;
 	}
-};
\ No newline at end of file
+};
diff --git a/test/tools/slickspeed.js b/test/tools/slickspeed.js
index 8602775..254e536 100644
--- a/test/tools/slickspeed.js
+++ b/test/tools/slickspeed.js
@@ -7,27 +7,27 @@ var helper = require("./helper.js"),
 var engines = [function(a,b){return CSSselect(b,a);}, soupselect.select];
 
 //returns true when an error occurs
-function testResult(rule, index){
+function testResult(rule){
 	var results = engines
 		.map(function(func){ return func(doc, rule); });
 
 	//check if both had the same result
 	for(var i = 1; i < results.length; i++){
 		//TODO: might be hard to debug with more engines
-		if(results[i-1].length !== results[i].length){
+		if(results[i - 1].length !== results[i].length){
 			//console.log(rule, results[i-1].length, results[i].length);
 			return true;
 		}
 		for(var j = 0; j < results[i].length; j++){
-			if(results[i-1][j] !== results[i][j]){
-				if(results[i-1].indexOf(results[i][j]) === -1){
+			if(results[i - 1][j] !== results[i][j]){
+				if(results[i - 1].indexOf(results[i][j]) === -1){
 					return true;
 				}
 			}
 		}
 		//require("assert").deepEqual(results[i-1], results[i], rule + ": not the same elements");
 	}
-	
+
 	return false;
 }
 
@@ -41,29 +41,29 @@ print("-----\n\nChecking performance\n\n");
 var ben = require("ben");
 
 function testSpeed(rule){
-	print(rule, Array(28-rule.length).join(" "));
+	print(rule, Array(28 - rule.length).join(" "));
 
 	var results = engines
 		.map(function(func){ return function(){ return func(doc, rule); }});
-	
+
 	//also add a precompiled CSSselect test
 	var compiled = CSSselect(rule);
 	results.unshift(function(){ return CSSselect.iterate(compiled, doc); });
-	
+
 	results = results.map(ben);
-	
+
 	var min = Math.min.apply(null, results);
 	var max = Math.max.apply(null, results);
 
 	results.forEach(function(result){
 		if(result === min) return print(" +", result, "+");
 		if(result === max) return print(" !", result, "!");
-		if(Math.abs(result-min) > Math.abs(result-max)){
+		if(Math.abs(result - min) > Math.abs(result - max)){
 			return print(" =", result, "=");
 		}
 		print(" ~", result, "~");
 	});
-	
+
 	print("\n");
 }
 
@@ -73,4 +73,4 @@ selectors.forEach(testSpeed);
 
 function print(){
 	process.stdout.write(Array.prototype.join.call(arguments, " "));
-}
\ No newline at end of file
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-css-select.git



More information about the Pkg-javascript-commits mailing list