ENHANCEMENT Only defining document.getElementsByClassName() in prototype.js if no native implementation exists (which speeds up the CMS). Ported from 'jquery13' module, thanks Hamish

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100849 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-03-11 02:29:23 +00:00 committed by Sam Minnee
parent b33c37c745
commit c53e76e6bf

View File

@ -1006,6 +1006,8 @@ Ajax.Evaluator = function(response) {
}
// Only define this if no native (and significantly faster) implementation exists.
if(!document.getElementsByClassName) {
document.getElementsByClassName = function(className, parentElement) {
var children = ($(parentElement) || document.body).getElementsByTagName('*');
return $A(children).inject([], function(elements, child) {
@ -1014,6 +1016,7 @@ document.getElementsByClassName = function(className, parentElement) {
return elements;
});
}
}
/*--------------------------------------------------------------------------*/