Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: polymer_1.2.3/bower_components/webcomponentsjs/HTMLImports.js

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_1.2.3/bower_components/webcomponentsjs/HTMLImports.js
diff --git a/polymer_1.0.4/bower_components/webcomponentsjs/HTMLImports.js b/polymer_1.2.3/bower_components/webcomponentsjs/HTMLImports.js
similarity index 91%
copy from polymer_1.0.4/bower_components/webcomponentsjs/HTMLImports.js
copy to polymer_1.2.3/bower_components/webcomponentsjs/HTMLImports.js
index e9f03ecf81873552c6d8ad81c86950c317999743..53859cc83e6572ebf63eabf1f0134cf8f8a23711 100644
--- a/polymer_1.0.4/bower_components/webcomponentsjs/HTMLImports.js
+++ b/polymer_1.2.3/bower_components/webcomponentsjs/HTMLImports.js
@@ -7,7 +7,7 @@
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
-// @version 0.7.5
+// @version 0.7.20
if (typeof WeakMap === "undefined") {
(function() {
var defineProperty = Object.defineProperty;
@@ -45,6 +45,9 @@ if (typeof WeakMap === "undefined") {
}
(function(global) {
+ if (global.JsMutationObserver) {
+ return;
+ }
var registrationsTable = new WeakMap();
var setImmediate;
if (/Trident|Edge/.test(navigator.userAgent)) {
@@ -340,8 +343,83 @@ if (typeof WeakMap === "undefined") {
}
};
global.JsMutationObserver = JsMutationObserver;
- if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
-})(this);
+ if (!global.MutationObserver) {
+ global.MutationObserver = JsMutationObserver;
+ JsMutationObserver._isPolyfilled = true;
+ }
+})(self);
+
+(function(scope) {
+ "use strict";
+ if (!window.performance) {
+ var start = Date.now();
+ window.performance = {
+ now: function() {
+ return Date.now() - start;
+ }
+ };
+ }
+ if (!window.requestAnimationFrame) {
+ window.requestAnimationFrame = function() {
+ var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
+ return nativeRaf ? function(callback) {
+ return nativeRaf(function() {
+ callback(performance.now());
+ });
+ } : function(callback) {
+ return window.setTimeout(callback, 1e3 / 60);
+ };
+ }();
+ }
+ if (!window.cancelAnimationFrame) {
+ window.cancelAnimationFrame = function() {
+ return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
+ clearTimeout(id);
+ };
+ }();
+ }
+ var workingDefaultPrevented = function() {
+ var e = document.createEvent("Event");
+ e.initEvent("foo", true, true);
+ e.preventDefault();
+ return e.defaultPrevented;
+ }();
+ if (!workingDefaultPrevented) {
+ var origPreventDefault = Event.prototype.preventDefault;
+ Event.prototype.preventDefault = function() {
+ if (!this.cancelable) {
+ return;
+ }
+ origPreventDefault.call(this);
+ Object.defineProperty(this, "defaultPrevented", {
+ get: function() {
+ return true;
+ },
+ configurable: true
+ });
+ };
+ }
+ var isIE = /Trident/.test(navigator.userAgent);
+ if (!window.CustomEvent || isIE && typeof window.CustomEvent !== "function") {
+ window.CustomEvent = function(inType, params) {
+ params = params || {};
+ var e = document.createEvent("CustomEvent");
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
+ return e;
+ };
+ window.CustomEvent.prototype = window.Event.prototype;
+ }
+ if (!window.Event || isIE && typeof window.Event !== "function") {
+ var origEvent = window.Event;
+ window.Event = function(inType, params) {
+ params = params || {};
+ var e = document.createEvent("Event");
+ e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));
+ return e;
+ };
+ window.Event.prototype = origEvent.prototype;
+ }
+})(window.WebComponents);
window.HTMLImports = window.HTMLImports || {
flags: {}
@@ -418,6 +496,7 @@ window.HTMLImports = window.HTMLImports || {
if (importCount) {
for (var i = 0, imp; i < importCount && (imp = imports[i]); i++) {
if (isImportLoaded(imp)) {
+ newImports.push(this);
parsedCount++;
checkDone();
} else {
@@ -544,10 +623,14 @@ window.HTMLImports.addModule(function(scope) {
request.open("GET", url, xhr.async);
request.addEventListener("readystatechange", function(e) {
if (request.readyState === 4) {
- var locationHeader = request.getResponseHeader("Location");
var redirectedUrl = null;
- if (locationHeader) {
- var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
+ try {
+ var locationHeader = request.getResponseHeader("Location");
+ if (locationHeader) {
+ redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
+ }
+ } catch (e) {
+ console.error(e.message);
}
next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
}
@@ -697,7 +780,7 @@ window.HTMLImports.addModule(function(scope) {
var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
var importParser = {
documentSelectors: IMPORT_SELECTOR,
- importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
+ importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
map: {
link: "parseLink",
script: "parseScript",
@@ -748,6 +831,7 @@ window.HTMLImports.addModule(function(scope) {
}
},
parseImport: function(elt) {
+ elt.import = elt.__doc;
if (window.HTMLImports.__importsParsingHook) {
window.HTMLImports.__importsParsingHook(elt);
}
@@ -810,6 +894,8 @@ window.HTMLImports.addModule(function(scope) {
trackElement: function(elt, callback) {
var self = this;
var done = function(e) {
+ elt.removeEventListener("load", done);
+ elt.removeEventListener("error", done);
if (callback) {
callback(e);
}
@@ -847,7 +933,9 @@ window.HTMLImports.addModule(function(scope) {
script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
scope.currentScript = scriptElt;
this.trackElement(script, function(e) {
- script.parentNode.removeChild(script);
+ if (script.parentNode) {
+ script.parentNode.removeChild(script);
+ }
scope.currentScript = null;
});
this.addElementToDocument(script);
@@ -863,7 +951,7 @@ window.HTMLImports.addModule(function(scope) {
for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
if (!this.isParsed(n)) {
if (this.hasResource(n)) {
- return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
+ return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
} else {
return;
}
@@ -886,7 +974,7 @@ window.HTMLImports.addModule(function(scope) {
return this.dynamicElements.indexOf(elt) >= 0;
},
hasResource: function(node) {
- if (nodeIsImport(node) && node.import === undefined) {
+ if (nodeIsImport(node) && node.__doc === undefined) {
return false;
}
return true;
@@ -960,7 +1048,7 @@ window.HTMLImports.addModule(function(scope) {
}
this.documents[url] = doc;
}
- elt.import = doc;
+ elt.__doc = doc;
}
parser.parseNext();
},
@@ -1056,22 +1144,6 @@ window.HTMLImports.addModule(function(scope) {
if (scope.useNative) {
return;
}
- if (isIE && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- e.preventDefault = function() {
- Object.defineProperty(this, "defaultPrevented", {
- get: function() {
- return true;
- }
- });
- };
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
initializeModules();
var rootDocument = scope.rootDocument;
function bootstrap() {

Powered by Google App Engine
This is Rietveld 408576698