diff --git a/Source/Slick.Finder.js b/Source/Slick.Finder.js index c02b365f..ba681033 100644 --- a/Source/Slick.Finder.js +++ b/Source/Slick.Finder.js @@ -44,6 +44,7 @@ local.setDocument = function(document){ = this.brokenMixedCaseQSA = this.brokenGEBCN = this.brokenCheckedQSA + = this.brokenEmptyAttributeQSA = this.isHTMLDocument = false; @@ -113,12 +114,18 @@ local.setDocument = function(document){ this.brokenGEBCN = cachedGetElementsByClassName || brokenSecondClassNameGEBCN; - // Webkit dont return selected options on QSA + // Webkit dont return selected options on querySelectorAll try { testNode.innerHTML = ''; this.brokenCheckedQSA = (testNode.querySelectorAll(':checked').length == 0); } catch(e){}; + // IE returns incorrect results for attr[*^$]="" selectors on querySelectorAll + try { + testNode.innerHTML = ''; + this.brokenEmptyAttributeQSA = (testNode.querySelectorAll('[class*=""]').length != 0); + } catch(e){}; + } root.removeChild(testNode); @@ -721,10 +728,13 @@ local.override = function(regexp, method){ /**/ +var reEmptyAttribute = /\[.*[*$^]=(?:["']{2})?\]/; + local.override(/./, function(expression, found, first){ //querySelectorAll override if (!this.querySelectorAll || this.nodeType != 9 || !local.isHTMLDocument || local.brokenMixedCaseQSA || - (local.brokenCheckedQSA && expression.indexOf(':checked') > -1) || Slick.disableQSA) return false; + (local.brokenCheckedQSA && expression.indexOf(':checked') > -1) || + (local.brokenEmptyAttributeQSA && reEmptyAttribute.test(expression)) || Slick.disableQSA) return false; var nodes, node; try {