OLD | NEW |
1 /** | 1 /** |
2 * @license | 2 * @license |
3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 3 * Copyright (c) 2014 The Polymer Project Authors. All rights reserved. |
4 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt | 4 * This code may only be used under the BSD style license found at http://polyme
r.github.io/LICENSE.txt |
5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt | 5 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.
txt |
6 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt | 6 * The complete set of contributors may be found at http://polymer.github.io/CON
TRIBUTORS.txt |
7 * Code distributed by Google as part of the polymer project is also | 7 * Code distributed by Google as part of the polymer project is also |
8 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt | 8 * subject to an additional IP rights grant found at http://polymer.github.io/PA
TENTS.txt |
9 */ | 9 */ |
10 // @version 0.7.21 | 10 // @version 0.7.23 |
11 (function() { | 11 (function() { |
12 window.WebComponents = window.WebComponents || { | 12 window.WebComponents = window.WebComponents || { |
13 flags: {} | 13 flags: {} |
14 }; | 14 }; |
15 var file = "webcomponents.js"; | 15 var file = "webcomponents.js"; |
16 var script = document.querySelector('script[src*="' + file + '"]'); | 16 var script = document.querySelector('script[src*="' + file + '"]'); |
17 var flags = {}; | 17 var flags = {}; |
18 if (!flags.noOpts) { | 18 if (!flags.noOpts) { |
19 location.search.slice(1).split("&").forEach(function(option) { | 19 location.search.slice(1).split("&").forEach(function(option) { |
20 var parts = option.split("="); | 20 var parts = option.split("="); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 this.__impl4cf1e782hg__[name] = v; | 204 this.__impl4cf1e782hg__[name] = v; |
205 }; | 205 }; |
206 } | 206 } |
207 function getMethod(name) { | 207 function getMethod(name) { |
208 return hasEval && isIdentifierName(name) ? new Function("return this.__imp
l4cf1e782hg__." + name + ".apply(this.__impl4cf1e782hg__, arguments)") : functio
n() { | 208 return hasEval && isIdentifierName(name) ? new Function("return this.__imp
l4cf1e782hg__." + name + ".apply(this.__impl4cf1e782hg__, arguments)") : functio
n() { |
209 return this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__, argu
ments); | 209 return this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__, argu
ments); |
210 }; | 210 }; |
211 } | 211 } |
212 function getDescriptor(source, name) { | 212 function getDescriptor(source, name) { |
213 try { | 213 try { |
| 214 if (source === window && name === "showModalDialog") { |
| 215 return dummyDescriptor; |
| 216 } |
214 return Object.getOwnPropertyDescriptor(source, name); | 217 return Object.getOwnPropertyDescriptor(source, name); |
215 } catch (ex) { | 218 } catch (ex) { |
216 return dummyDescriptor; | 219 return dummyDescriptor; |
217 } | 220 } |
218 } | 221 } |
219 var isBrokenSafari = function() { | 222 var isBrokenSafari = function() { |
220 var descr = Object.getOwnPropertyDescriptor(Node.prototype, "nodeType"); | 223 var descr = Object.getOwnPropertyDescriptor(Node.prototype, "nodeType"); |
221 return descr && !descr.get && !descr.set; | 224 return descr && !descr.get && !descr.set; |
222 }(); | 225 }(); |
223 function installProperty(source, target, allowMethod, opt_blacklist) { | 226 function installProperty(source, target, allowMethod, opt_blacklist) { |
(...skipping 4425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4649 for (var i = 0; i < shadowDOMSelectorsRe.length; i++) { | 4652 for (var i = 0; i < shadowDOMSelectorsRe.length; i++) { |
4650 cssText = cssText.replace(shadowDOMSelectorsRe[i], " "); | 4653 cssText = cssText.replace(shadowDOMSelectorsRe[i], " "); |
4651 } | 4654 } |
4652 return cssText; | 4655 return cssText; |
4653 }, | 4656 }, |
4654 scopeRules: function(cssRules, scopeSelector) { | 4657 scopeRules: function(cssRules, scopeSelector) { |
4655 var cssText = ""; | 4658 var cssText = ""; |
4656 if (cssRules) { | 4659 if (cssRules) { |
4657 Array.prototype.forEach.call(cssRules, function(rule) { | 4660 Array.prototype.forEach.call(cssRules, function(rule) { |
4658 if (rule.selectorText && (rule.style && rule.style.cssText !== undef
ined)) { | 4661 if (rule.selectorText && (rule.style && rule.style.cssText !== undef
ined)) { |
4659 cssText += this.scopeSelector(rule.selectorText, scopeSelector, th
is.strictStyling) + " {\n» "; | 4662 cssText += this.scopeSelector(rule.selectorText, scopeSelector, th
is.strictStyling) + " {\n\t"; |
4660 cssText += this.propertiesFromRule(rule) + "\n}\n\n"; | 4663 cssText += this.propertiesFromRule(rule) + "\n}\n\n"; |
4661 } else if (rule.type === CSSRule.MEDIA_RULE) { | 4664 } else if (rule.type === CSSRule.MEDIA_RULE) { |
4662 cssText += "@media " + rule.media.mediaText + " {\n"; | 4665 cssText += "@media " + rule.media.mediaText + " {\n"; |
4663 cssText += this.scopeRules(rule.cssRules, scopeSelector); | 4666 cssText += this.scopeRules(rule.cssRules, scopeSelector); |
4664 cssText += "\n}\n\n"; | 4667 cssText += "\n}\n\n"; |
4665 } else { | 4668 } else { |
4666 try { | 4669 try { |
4667 if (rule.cssText) { | 4670 if (rule.cssText) { |
4668 cssText += rule.cssText + "\n\n"; | 4671 cssText += rule.cssText + "\n\n"; |
4669 } | 4672 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4768 }, | 4771 }, |
4769 addCssToDocument: function(cssText, name) { | 4772 addCssToDocument: function(cssText, name) { |
4770 if (cssText.match("@import")) { | 4773 if (cssText.match("@import")) { |
4771 addOwnSheet(cssText, name); | 4774 addOwnSheet(cssText, name); |
4772 } else { | 4775 } else { |
4773 addCssToDocument(cssText); | 4776 addCssToDocument(cssText); |
4774 } | 4777 } |
4775 } | 4778 } |
4776 }; | 4779 }; |
4777 var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^\/
*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^\/*
][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[
^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s
@polyfill-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-r
ule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe
= /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentUn
scopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*
[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/g
im, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext",
parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)"; | 4780 var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^\/
*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^\/*
][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[
^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s
@polyfill-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-r
ule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe
= /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^\/*][^*]*\*+)*)\//gim, cssContentUn
scopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*
[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/g
im, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext",
parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)"; |
4778 var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cs
sColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim")
, selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, co
lonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost
+ "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHo
stContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ /
>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g
, /\^\^/g, /\^/g ]; | 4781 var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cs
sColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim")
, selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, co
lonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost
+ "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHo
stContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ /
>>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g
, /\^\^/g, /\^(?!=)/g ]; |
4779 function stylesToCssText(styles, preserveComments) { | 4782 function stylesToCssText(styles, preserveComments) { |
4780 var cssText = ""; | 4783 var cssText = ""; |
4781 Array.prototype.forEach.call(styles, function(s) { | 4784 Array.prototype.forEach.call(styles, function(s) { |
4782 cssText += s.textContent + "\n\n"; | 4785 cssText += s.textContent + "\n\n"; |
4783 }); | 4786 }); |
4784 if (!preserveComments) { | 4787 if (!preserveComments) { |
4785 cssText = cssText.replace(cssCommentRe, ""); | 4788 cssText = cssText.replace(cssCommentRe, ""); |
4786 } | 4789 } |
4787 return cssText; | 4790 return cssText; |
4788 } | 4791 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5048 break; | 5051 break; |
5049 | 5052 |
5050 case "scheme data": | 5053 case "scheme data": |
5051 if ("?" == c) { | 5054 if ("?" == c) { |
5052 this._query = "?"; | 5055 this._query = "?"; |
5053 state = "query"; | 5056 state = "query"; |
5054 } else if ("#" == c) { | 5057 } else if ("#" == c) { |
5055 this._fragment = "#"; | 5058 this._fragment = "#"; |
5056 state = "fragment"; | 5059 state = "fragment"; |
5057 } else { | 5060 } else { |
5058 if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 5061 if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
5059 this._schemeData += percentEscape(c); | 5062 this._schemeData += percentEscape(c); |
5060 } | 5063 } |
5061 } | 5064 } |
5062 break; | 5065 break; |
5063 | 5066 |
5064 case "no scheme": | 5067 case "no scheme": |
5065 if (!base || !isRelativeScheme(base._scheme)) { | 5068 if (!base || !isRelativeScheme(base._scheme)) { |
5066 err("Missing scheme."); | 5069 err("Missing scheme."); |
5067 invalid.call(this); | 5070 invalid.call(this); |
5068 } else { | 5071 } else { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5179 | 5182 |
5180 case "authority": | 5183 case "authority": |
5181 if ("@" == c) { | 5184 if ("@" == c) { |
5182 if (seenAt) { | 5185 if (seenAt) { |
5183 err("@ already seen."); | 5186 err("@ already seen."); |
5184 buffer += "%40"; | 5187 buffer += "%40"; |
5185 } | 5188 } |
5186 seenAt = true; | 5189 seenAt = true; |
5187 for (var i = 0; i < buffer.length; i++) { | 5190 for (var i = 0; i < buffer.length; i++) { |
5188 var cp = buffer[i]; | 5191 var cp = buffer[i]; |
5189 if ("» " == cp || "\n" == cp || "\r" == cp) { | 5192 if ("\t" == cp || "\n" == cp || "\r" == cp) { |
5190 err("Invalid whitespace in authority."); | 5193 err("Invalid whitespace in authority."); |
5191 continue; | 5194 continue; |
5192 } | 5195 } |
5193 if (":" == cp && null === this._password) { | 5196 if (":" == cp && null === this._password) { |
5194 this._password = ""; | 5197 this._password = ""; |
5195 continue; | 5198 continue; |
5196 } | 5199 } |
5197 var tempC = percentEscape(cp); | 5200 var tempC = percentEscape(cp); |
5198 null !== this._password ? this._password += tempC : this._username +
= tempC; | 5201 null !== this._password ? this._password += tempC : this._username +
= tempC; |
5199 } | 5202 } |
(...skipping 13 matching lines...) Expand all Loading... |
5213 if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" |
| buffer[1] == "|")) { | 5216 if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ":" |
| buffer[1] == "|")) { |
5214 state = "relative path"; | 5217 state = "relative path"; |
5215 } else if (buffer.length == 0) { | 5218 } else if (buffer.length == 0) { |
5216 state = "relative path start"; | 5219 state = "relative path start"; |
5217 } else { | 5220 } else { |
5218 this._host = IDNAToASCII.call(this, buffer); | 5221 this._host = IDNAToASCII.call(this, buffer); |
5219 buffer = ""; | 5222 buffer = ""; |
5220 state = "relative path start"; | 5223 state = "relative path start"; |
5221 } | 5224 } |
5222 continue; | 5225 continue; |
5223 } else if ("» " == c || "\n" == c || "\r" == c) { | 5226 } else if ("\t" == c || "\n" == c || "\r" == c) { |
5224 err("Invalid whitespace in file host."); | 5227 err("Invalid whitespace in file host."); |
5225 } else { | 5228 } else { |
5226 buffer += c; | 5229 buffer += c; |
5227 } | 5230 } |
5228 break; | 5231 break; |
5229 | 5232 |
5230 case "host": | 5233 case "host": |
5231 case "hostname": | 5234 case "hostname": |
5232 if (":" == c && !seenBracket) { | 5235 if (":" == c && !seenBracket) { |
5233 this._host = IDNAToASCII.call(this, buffer); | 5236 this._host = IDNAToASCII.call(this, buffer); |
5234 buffer = ""; | 5237 buffer = ""; |
5235 state = "port"; | 5238 state = "port"; |
5236 if ("hostname" == stateOverride) { | 5239 if ("hostname" == stateOverride) { |
5237 break loop; | 5240 break loop; |
5238 } | 5241 } |
5239 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) { | 5242 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c) { |
5240 this._host = IDNAToASCII.call(this, buffer); | 5243 this._host = IDNAToASCII.call(this, buffer); |
5241 buffer = ""; | 5244 buffer = ""; |
5242 state = "relative path start"; | 5245 state = "relative path start"; |
5243 if (stateOverride) { | 5246 if (stateOverride) { |
5244 break loop; | 5247 break loop; |
5245 } | 5248 } |
5246 continue; | 5249 continue; |
5247 } else if ("» " != c && "\n" != c && "\r" != c) { | 5250 } else if ("\t" != c && "\n" != c && "\r" != c) { |
5248 if ("[" == c) { | 5251 if ("[" == c) { |
5249 seenBracket = true; | 5252 seenBracket = true; |
5250 } else if ("]" == c) { | 5253 } else if ("]" == c) { |
5251 seenBracket = false; | 5254 seenBracket = false; |
5252 } | 5255 } |
5253 buffer += c; | 5256 buffer += c; |
5254 } else { | 5257 } else { |
5255 err("Invalid code point in host/hostname: " + c); | 5258 err("Invalid code point in host/hostname: " + c); |
5256 } | 5259 } |
5257 break; | 5260 break; |
5258 | 5261 |
5259 case "port": | 5262 case "port": |
5260 if (/[0-9]/.test(c)) { | 5263 if (/[0-9]/.test(c)) { |
5261 buffer += c; | 5264 buffer += c; |
5262 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c ||
stateOverride) { | 5265 } else if (EOF == c || "/" == c || "\\" == c || "?" == c || "#" == c ||
stateOverride) { |
5263 if ("" != buffer) { | 5266 if ("" != buffer) { |
5264 var temp = parseInt(buffer, 10); | 5267 var temp = parseInt(buffer, 10); |
5265 if (temp != relative[this._scheme]) { | 5268 if (temp != relative[this._scheme]) { |
5266 this._port = temp + ""; | 5269 this._port = temp + ""; |
5267 } | 5270 } |
5268 buffer = ""; | 5271 buffer = ""; |
5269 } | 5272 } |
5270 if (stateOverride) { | 5273 if (stateOverride) { |
5271 break loop; | 5274 break loop; |
5272 } | 5275 } |
5273 state = "relative path start"; | 5276 state = "relative path start"; |
5274 continue; | 5277 continue; |
5275 } else if ("» " == c || "\n" == c || "\r" == c) { | 5278 } else if ("\t" == c || "\n" == c || "\r" == c) { |
5276 err("Invalid code point in port: " + c); | 5279 err("Invalid code point in port: " + c); |
5277 } else { | 5280 } else { |
5278 invalid.call(this); | 5281 invalid.call(this); |
5279 } | 5282 } |
5280 break; | 5283 break; |
5281 | 5284 |
5282 case "relative path start": | 5285 case "relative path start": |
5283 if ("\\" == c) err("'\\' not allowed in path."); | 5286 if ("\\" == c) err("'\\' not allowed in path."); |
5284 state = "relative path"; | 5287 state = "relative path"; |
5285 if ("/" != c && "\\" != c) { | 5288 if ("/" != c && "\\" != c) { |
(...skipping 24 matching lines...) Expand all Loading... |
5310 this._path.push(buffer); | 5313 this._path.push(buffer); |
5311 } | 5314 } |
5312 buffer = ""; | 5315 buffer = ""; |
5313 if ("?" == c) { | 5316 if ("?" == c) { |
5314 this._query = "?"; | 5317 this._query = "?"; |
5315 state = "query"; | 5318 state = "query"; |
5316 } else if ("#" == c) { | 5319 } else if ("#" == c) { |
5317 this._fragment = "#"; | 5320 this._fragment = "#"; |
5318 state = "fragment"; | 5321 state = "fragment"; |
5319 } | 5322 } |
5320 } else if ("» " != c && "\n" != c && "\r" != c) { | 5323 } else if ("\t" != c && "\n" != c && "\r" != c) { |
5321 buffer += percentEscape(c); | 5324 buffer += percentEscape(c); |
5322 } | 5325 } |
5323 break; | 5326 break; |
5324 | 5327 |
5325 case "query": | 5328 case "query": |
5326 if (!stateOverride && "#" == c) { | 5329 if (!stateOverride && "#" == c) { |
5327 this._fragment = "#"; | 5330 this._fragment = "#"; |
5328 state = "fragment"; | 5331 state = "fragment"; |
5329 } else if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 5332 } else if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
5330 this._query += percentEscapeQuery(c); | 5333 this._query += percentEscapeQuery(c); |
5331 } | 5334 } |
5332 break; | 5335 break; |
5333 | 5336 |
5334 case "fragment": | 5337 case "fragment": |
5335 if (EOF != c && "» " != c && "\n" != c && "\r" != c) { | 5338 if (EOF != c && "\t" != c && "\n" != c && "\r" != c) { |
5336 this._fragment += c; | 5339 this._fragment += c; |
5337 } | 5340 } |
5338 break; | 5341 break; |
5339 } | 5342 } |
5340 cursor++; | 5343 cursor++; |
5341 } | 5344 } |
5342 } | 5345 } |
5343 function clear() { | 5346 function clear() { |
5344 this._scheme = ""; | 5347 this._scheme = ""; |
5345 this._schemeData = ""; | 5348 this._schemeData = ""; |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5761 }; | 5764 }; |
5762 global.JsMutationObserver = JsMutationObserver; | 5765 global.JsMutationObserver = JsMutationObserver; |
5763 if (!global.MutationObserver) { | 5766 if (!global.MutationObserver) { |
5764 global.MutationObserver = JsMutationObserver; | 5767 global.MutationObserver = JsMutationObserver; |
5765 JsMutationObserver._isPolyfilled = true; | 5768 JsMutationObserver._isPolyfilled = true; |
5766 } | 5769 } |
5767 })(self); | 5770 })(self); |
5768 | 5771 |
5769 (function(scope) { | 5772 (function(scope) { |
5770 "use strict"; | 5773 "use strict"; |
5771 if (!window.performance) { | 5774 if (!(window.performance && window.performance.now)) { |
5772 var start = Date.now(); | 5775 var start = Date.now(); |
5773 window.performance = { | 5776 window.performance = { |
5774 now: function() { | 5777 now: function() { |
5775 return Date.now() - start; | 5778 return Date.now() - start; |
5776 } | 5779 } |
5777 }; | 5780 }; |
5778 } | 5781 } |
5779 if (!window.requestAnimationFrame) { | 5782 if (!window.requestAnimationFrame) { |
5780 window.requestAnimationFrame = function() { | 5783 window.requestAnimationFrame = function() { |
5781 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni
mationFrame; | 5784 var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAni
mationFrame; |
(...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6923 if (isReservedTag(name)) { | 6926 if (isReservedTag(name)) { |
6924 throw new Error("Failed to execute 'registerElement' on 'Document': Regist
ration failed for type '" + String(name) + "'. The type name is invalid."); | 6927 throw new Error("Failed to execute 'registerElement' on 'Document': Regist
ration failed for type '" + String(name) + "'. The type name is invalid."); |
6925 } | 6928 } |
6926 if (getRegisteredDefinition(name)) { | 6929 if (getRegisteredDefinition(name)) { |
6927 throw new Error("DuplicateDefinitionError: a type with name '" + String(na
me) + "' is already registered"); | 6930 throw new Error("DuplicateDefinitionError: a type with name '" + String(na
me) + "' is already registered"); |
6928 } | 6931 } |
6929 if (!definition.prototype) { | 6932 if (!definition.prototype) { |
6930 definition.prototype = Object.create(HTMLElement.prototype); | 6933 definition.prototype = Object.create(HTMLElement.prototype); |
6931 } | 6934 } |
6932 definition.__name = name.toLowerCase(); | 6935 definition.__name = name.toLowerCase(); |
| 6936 if (definition.extends) { |
| 6937 definition.extends = definition.extends.toLowerCase(); |
| 6938 } |
6933 definition.lifecycle = definition.lifecycle || {}; | 6939 definition.lifecycle = definition.lifecycle || {}; |
6934 definition.ancestry = ancestry(definition.extends); | 6940 definition.ancestry = ancestry(definition.extends); |
6935 resolveTagName(definition); | 6941 resolveTagName(definition); |
6936 resolvePrototypeChain(definition); | 6942 resolvePrototypeChain(definition); |
6937 overrideAttributeApi(definition.prototype); | 6943 overrideAttributeApi(definition.prototype); |
6938 registerDefinition(definition.__name, definition); | 6944 registerDefinition(definition.__name, definition); |
6939 definition.ctor = generateConstructor(definition); | 6945 definition.ctor = generateConstructor(definition); |
6940 definition.ctor.prototype = definition.prototype; | 6946 definition.ctor.prototype = definition.prototype; |
6941 definition.prototype.constructor = definition.ctor; | 6947 definition.prototype.constructor = definition.ctor; |
6942 if (scope.ready) { | 6948 if (scope.ready) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7095 function wrapDomMethodToForceUpgrade(obj, methodName) { | 7101 function wrapDomMethodToForceUpgrade(obj, methodName) { |
7096 var orig = obj[methodName]; | 7102 var orig = obj[methodName]; |
7097 obj[methodName] = function() { | 7103 obj[methodName] = function() { |
7098 var n = orig.apply(this, arguments); | 7104 var n = orig.apply(this, arguments); |
7099 upgradeAll(n); | 7105 upgradeAll(n); |
7100 return n; | 7106 return n; |
7101 }; | 7107 }; |
7102 } | 7108 } |
7103 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); | 7109 wrapDomMethodToForceUpgrade(Node.prototype, "cloneNode"); |
7104 wrapDomMethodToForceUpgrade(document, "importNode"); | 7110 wrapDomMethodToForceUpgrade(document, "importNode"); |
7105 if (isIE) { | |
7106 (function() { | |
7107 var importNode = document.importNode; | |
7108 document.importNode = function() { | |
7109 var n = importNode.apply(document, arguments); | |
7110 if (n.nodeType == n.DOCUMENT_FRAGMENT_NODE) { | |
7111 var f = document.createDocumentFragment(); | |
7112 f.appendChild(n); | |
7113 return f; | |
7114 } else { | |
7115 return n; | |
7116 } | |
7117 }; | |
7118 })(); | |
7119 } | |
7120 document.registerElement = register; | 7111 document.registerElement = register; |
7121 document.createElement = createElement; | 7112 document.createElement = createElement; |
7122 document.createElementNS = createElementNS; | 7113 document.createElementNS = createElementNS; |
7123 scope.registry = registry; | 7114 scope.registry = registry; |
7124 scope.instanceof = isInstance; | 7115 scope.instanceof = isInstance; |
7125 scope.reservedTagList = reservedTagList; | 7116 scope.reservedTagList = reservedTagList; |
7126 scope.getRegisteredDefinition = getRegisteredDefinition; | 7117 scope.getRegisteredDefinition = getRegisteredDefinition; |
7127 document.register = document.registerElement; | 7118 document.register = document.registerElement; |
7128 }); | 7119 }); |
7129 | 7120 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7209 (function(scope) { | 7200 (function(scope) { |
7210 var style = document.createElement("style"); | 7201 var style = document.createElement("style"); |
7211 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; | 7202 style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " }
\n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; posi
tion: relative;" + " } \n"; |
7212 var head = document.querySelector("head"); | 7203 var head = document.querySelector("head"); |
7213 head.insertBefore(style, head.firstChild); | 7204 head.insertBefore(style, head.firstChild); |
7214 })(window.WebComponents); | 7205 })(window.WebComponents); |
7215 | 7206 |
7216 (function(scope) { | 7207 (function(scope) { |
7217 window.Platform = scope; | 7208 window.Platform = scope; |
7218 })(window.WebComponents); | 7209 })(window.WebComponents); |
OLD | NEW |