prototype: Ensure HTMLElement exists before creating Element.extend.
This commit is contained in:
parent
4a648c6434
commit
ae2ea8a2e9
|
@ -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]
|
||||
|
|
14
src/dom.js
14
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);
|
||||
|
|
Loading…
Reference in New Issue