From 60e23ddad202545fa3fe7774f9ba2939d652eb42 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 4 Jul 2020 21:40:42 +0900 Subject: [PATCH] Update webloader.js --- webloader.js | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/webloader.js b/webloader.js index cdf0963..f3bf3ff 100644 --- a/webloader.js +++ b/webloader.js @@ -3,33 +3,10 @@ */ var FILE = require('lib/file'); -if (!window.Element) { +// "less than IE 9"; +if (!window.addEventListener) { Element = function() {}; - var __createElement = document.createElement; - document.createElement = function(tagName) { - var element = __createElement(tagName); - if (element == null) { - return null; - } - for (var key in Element.prototype) - element[key] = Element.prototype[key]; - return element; - } - - var __getElementById = document.getElementById; - document.getElementById = function(id) { - var element = __getElementById(id); - if (element == null) { - return null; - } - for (var key in Element.prototype) - element[key] = Element.prototype[key]; - return element; - } -} - -if (!window.addEventListener) { (function(WindowPrototype, DocumentPrototype, ElementPrototype, registry) { DocumentPrototype.head = (function() { return DocumentPrototype.getElementsByTagName("head")[0]; @@ -71,9 +48,32 @@ if (!window.addEventListener) { inject(WindowPrototype, registry); inject(DocumentPrototype, registry); inject(ElementPrototype, registry); + + var __createElement = DocumentPrototype.createElement; + DocumentPrototype.createElement = function(tagName) { + var element = __createElement(tagName); + if (element == null) { + return null; + } + for (var key in ElementPrototype) + element[key] = ElementPrototype[key]; + return element; + } + + var __getElementById = DocumentPrototype.getElementById; + DocumentPrototype.getElementById = function(id) { + var element = __getElementById(id); + if (element == null) { + return null; + } + for (var key in ElementPrototype) + element[key] = ElementPrototype[key]; + return element; + } })(window, document, Element.prototype, []); } +// "get IE version"; var IEVersion = (function() { var undef, v = 3,