From ae2ea8a2e930528e5d850ab4556b19aa28bc258c Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Sat, 9 Jun 2007 01:51:26 +0000 Subject: [PATCH] prototype: Ensure HTMLElement exists before creating Element.extend. --- CHANGELOG | 2 ++ src/dom.js | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 14c5c6d..2e2d17a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/dom.js b/src/dom.js index 296b515..23fe5b1 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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);