Created
July 12, 2010 13:44
-
-
Save drinks/472471 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) (function(){ | |
var div = document.createElement("div"); | |
div.innerHTML = "<div class='test e'></div><div class='test'></div>"; | |
// Opera can't find a second classname (in 9.6) | |
if ( div.getElementsByClassName("e").length === 0 ) | |
return; | |
// Safari caches class attributes, doesn't catch changes (in 3.2) | |
div.lastChild.className = "e"; | |
if ( div.getElementsByClassName("e").length === 1 ) | |
return; | |
Expr.order.splice(1, 0, "CLASS"); | |
Expr.find.CLASS = function(match, context, isXML) { | |
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { | |
return context.getElementsByClassName(match[1]); | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment