From 32c44b071ddae5a2d5521ef654cdf9ac92960b01 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:32:19 +0000 Subject: [PATCH] MINOR Added prototypefix helper scripts from jquery13 module to fix document.getElementsByClassName() override by prototypejs git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@92548 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/prototypefix/README | 7 +++++++ javascript/prototypefix/intro.js | 1 + javascript/prototypefix/outro.js | 1 + 3 files changed, 9 insertions(+) create mode 100644 javascript/prototypefix/README create mode 100644 javascript/prototypefix/intro.js create mode 100644 javascript/prototypefix/outro.js diff --git a/javascript/prototypefix/README b/javascript/prototypefix/README new file mode 100644 index 000000000..c89c713cf --- /dev/null +++ b/javascript/prototypefix/README @@ -0,0 +1,7 @@ +Prototype replaces document.getElementsByClassName with it's own version. However many browsers +now come with their own implementation, and prototype's is much slower. + +This fixes this by restoring the original after prototype is loaded. + +@todo: Safari 3 used to come with a broken document.getElementsByClassName. We should use +the same checks jQuery does and not restore the function if it doesn't work the same as the spec. \ No newline at end of file diff --git a/javascript/prototypefix/intro.js b/javascript/prototypefix/intro.js new file mode 100644 index 000000000..edae2e9fd --- /dev/null +++ b/javascript/prototypefix/intro.js @@ -0,0 +1 @@ +var browserGetElementsByClassName = document.getElementsByClassName; \ No newline at end of file diff --git a/javascript/prototypefix/outro.js b/javascript/prototypefix/outro.js new file mode 100644 index 000000000..aa3d55aab --- /dev/null +++ b/javascript/prototypefix/outro.js @@ -0,0 +1 @@ +if (browserGetElementsByClassName) document.getElementsByClassName = browserGetElementsByClassName;