*/
(function(){
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
done = 0,
toString = Object.prototype.toString;
CLASS: function(match, curLoop, inplace, result, not){
match = " " + match[1].replace(/\\/g, "") + " ";
- for ( var i = 0; curLoop[i] != null; i++ ) {
- if ( curLoop[i] ) {
- if ( not ^ (" " + curLoop[i].className + " ").indexOf(match) >= 0 ) {
+ var elem;
+ for ( var i = 0; (elem = curLoop[i]) != null; i++ ) {
+ if ( elem ) {
+ if ( not ^ (" " + elem.className + " ").indexOf(match) >= 0 ) {
if ( !inplace )
- result.push( curLoop[i] );
+ result.push( elem );
} else if ( inplace ) {
curLoop[i] = false;
}
CHILD: function(elem, match){
var type = match[1], parent = elem.parentNode;
- var doneName = "child" + parent.childNodes.length;
+ var doneName = match[0];
if ( parent && (!parent[ doneName ] || !elem.nodeIndex) ) {
var count = 1;
ATTR: function(elem, match){
var result = Expr.attrHandle[ match[1] ] ? Expr.attrHandle[ match[1] ]( elem ) : elem[ match[1] ] || elem.getAttribute( match[1] ), value = result + "", type = match[2], check = match[4];
return result == null ?
- false :
+ type === "!=" :
type === "=" ?
value === check :
type === "*=" ?
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
- if ( div.firstChild.getAttribute("href") !== "#" ) {
+ if ( div.firstChild && div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function(elem){
return elem.getAttribute("href", 2);
};
};
var isXML = function(elem){
- return elem && elem.nodeType === 9 && elem.nodeName !== "HTML" ||
- isXML( elem.ownerDocument );
+ return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+ !!elem.ownerDocument && isXML( elem.ownerDocument );
};
var posProcess = function(selector, context){
}
return Sizzle.filter( later, tmpSet );
-}
+};
// EXPOSE
jQuery.find = Sizzle;