mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
b33c37c745
commit
c53e76e6bf
17
thirdparty/prototype/prototype.js
vendored
17
thirdparty/prototype/prototype.js
vendored
@ -1006,13 +1006,16 @@ Ajax.Evaluator = function(response) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementsByClassName = function(className, parentElement) {
|
// Only define this if no native (and significantly faster) implementation exists.
|
||||||
var children = ($(parentElement) || document.body).getElementsByTagName('*');
|
if(!document.getElementsByClassName) {
|
||||||
return $A(children).inject([], function(elements, child) {
|
document.getElementsByClassName = function(className, parentElement) {
|
||||||
if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
|
var children = ($(parentElement) || document.body).getElementsByTagName('*');
|
||||||
elements.push(child);
|
return $A(children).inject([], function(elements, child) {
|
||||||
return elements;
|
if (child.className.match(new RegExp("(^|\\s)" + className + "(\\s|$)")))
|
||||||
});
|
elements.push(child);
|
||||||
|
return elements;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
Loading…
Reference in New Issue
Block a user