Prototype extension methods load time difference

If you use prototype.js, you know that the library adds many helper methods to the standard types. But for the Element type(i.e. elements in a page), did you know that these methods are loaded at different times depending on which browser it is. FF loads the methods at the time of creation, so as soon as you do:
myDiv = document.createElement('div');
all the helpers are available to you from myDiv.
But, in IE, this is not the case.

Instead IE loads the methods at the time you insert the elemnet into the page:
parent.insert(myDiv);



Correction:
In IE you must either manually extend the element, see here, or locate the element using $() or other locate function in prototype.js in order to get the helper methods.

blog comments powered by Disqus