Added support for sorting in Safari - when querySelectorAll isn't able to be used.

This commit is contained in:
John Resig 2009-02-14 18:10:45 +00:00
parent d75c899fe7
commit 6f4b08cdf9
3 changed files with 17 additions and 3 deletions

View file

@ -679,6 +679,17 @@ if ( document.documentElement.compareDocumentPosition ) {
}
return ret;
};
} else if ( Array.prototype.indexOf ) {
var indexOf = Array.prototype.indexOf,
allSort = document.getElementsByTagName("*");
sortOrder = function( a, b ) {
var ret = indexOf.call( allSort, a ) - indexOf.call( allSort, b );
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
}
// Check to see if the browser returns elements by name when