Added logic for not using getElementsByClassName in different failure states. Fixes jQuery bugs #4058 and #4042.
This commit is contained in:
parent
ce00f88ae2
commit
2b7642cff0
2 changed files with 28 additions and 4 deletions
|
@ -741,12 +741,25 @@ if ( document.querySelectorAll ) (function(){
|
|||
Sizzle.matches = oldSizzle.matches;
|
||||
})();
|
||||
|
||||
if ( document.getElementsByClassName && document.documentElement.getElementsByClassName ) {
|
||||
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) {
|
||||
return context.getElementsByClassName(match[1]);
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
|
||||
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue