prototype: Ensure HTMLElement exists before creating Element.extend.

This commit is contained in:
Sam Stephenson 2007-06-09 01:51:26 +00:00
parent 4a648c6434
commit ae2ea8a2e9
2 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,7 @@
*SVN*
* Ensure HTMLElement exists before creating Element.extend. [Tobie Langel]
* Add Number.prototype.round/ceil/floor/abs as an aliases to the respective methods in Math. Refactor to seperate number extensions from base.js. [Thomas Fuchs]
* Make Element#absolutize and Element#relativize properly use Element#getStyle. Closes #8580. [Christophe Porteneuve]

View File

@ -914,6 +914,13 @@ Element.Methods.ByTag = {};
Object.extend(Element, Element.Methods);
if (!Prototype.BrowserFeatures.ElementExtensions &&
document.createElement('div').__proto__) {
window.HTMLElement = {};
window.HTMLElement.prototype = document.createElement('div').__proto__;
Prototype.BrowserFeatures.ElementExtensions = true;
}
Element.extend = (function() {
if (Prototype.BrowserFeatures.SpecificElementExtensions)
return Prototype.K;
@ -953,13 +960,6 @@ Element.extend = (function() {
return extend;
})();
if (!Prototype.BrowserFeatures.ElementExtensions &&
document.createElement('div').__proto__) {
window.HTMLElement = {};
window.HTMLElement.prototype = document.createElement('div').__proto__;
Prototype.BrowserFeatures.ElementExtensions = true;
}
Element.hasAttribute = function(element, attribute) {
if (element.hasAttribute) return element.hasAttribute(attribute);
return Element.Methods.Simulated.hasAttribute(element, attribute);