Fixed a missing semicolon. Fixes jQuery bug #3927.
[jquery.git] / src / selector.js
index 682a92e..6b68cb2 100644 (file)
@@ -6,7 +6,7 @@
  */
 (function(){
 
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]+['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,
        done = 0,
        toString = Object.prototype.toString;
 
@@ -332,11 +332,12 @@ var Expr = Sizzle.selectors = {
                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;
                                        }
@@ -700,7 +701,7 @@ try {
 
        // 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);
                };
@@ -809,8 +810,8 @@ var contains = document.compareDocumentPosition ?  function(a, b){
 };
 
 var isXML = function(elem){
-       return elem.documentElement && !elem.body ||
-               elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
+       return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
+               !!elem.ownerDocument && isXML( elem.ownerDocument );
 };
 
 var posProcess = function(selector, context){
@@ -831,7 +832,7 @@ var posProcess = function(selector, context){
        }
 
        return Sizzle.filter( later, tmpSet );
-}
+};
 
 // EXPOSE
 jQuery.find = Sizzle;