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;