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

Unified Diff: polymer_0.5.4/bower_components/webcomponentsjs/webcomponents.js

Issue 895523005: Added Polymer 0.5.4 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 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_0.5.4/bower_components/webcomponentsjs/webcomponents.js
diff --git a/polymer_0.5.0/bower_components/webcomponentsjs/webcomponents.js b/polymer_0.5.4/bower_components/webcomponentsjs/webcomponents.js
similarity index 99%
copy from polymer_0.5.0/bower_components/webcomponentsjs/webcomponents.js
copy to polymer_0.5.4/bower_components/webcomponentsjs/webcomponents.js
index 06f9a32eac254978ca8b7f03eb8004909295e101..b22d52b72e1d16f8454849fc6398c957530a7f64 100644
--- a/polymer_0.5.0/bower_components/webcomponentsjs/webcomponents.js
+++ b/polymer_0.5.4/bower_components/webcomponentsjs/webcomponents.js
@@ -7,14 +7,13 @@
* 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.5.1-1
+// @version 0.5.4
window.WebComponents = window.WebComponents || {};
(function(scope) {
var flags = scope.flags || {};
var file = "webcomponents.js";
var script = document.querySelector('script[src*="' + file + '"]');
- var flags = {};
if (!flags.noOpts) {
location.search.slice(1).split("&").forEach(function(o) {
o = o.split("=");
@@ -1993,7 +1992,7 @@ if (WebComponents.flags.shadow) {
for (var i = 0, n; i < nodes.length; i++) {
n = nodes[i];
if (n.nodeType === Node.TEXT_NODE) {
- if (!modNode && !n.data.length) this.removeNode(n); else if (!modNode) modNode = n; else {
+ if (!modNode && !n.data.length) this.removeChild(n); else if (!modNode) modNode = n; else {
s += n.data;
remNodes.push(n);
}
@@ -2328,51 +2327,52 @@ if (WebComponents.flags.shadow) {
})(window.ShadowDOMPolyfill);
(function(scope) {
"use strict";
- var setWrapper = scope.setWrapper;
var unsafeUnwrap = scope.unsafeUnwrap;
+ var enqueueMutation = scope.enqueueMutation;
+ function getClass(el) {
+ return unsafeUnwrap(el).getAttribute("class");
+ }
+ function enqueueClassAttributeChange(el, oldValue) {
+ enqueueMutation(el, "attributes", {
+ name: "class",
+ namespace: null,
+ oldValue: oldValue
+ });
+ }
function invalidateClass(el) {
scope.invalidateRendererBasedOnAttribute(el, "class");
}
- function DOMTokenList(impl, ownerElement) {
- setWrapper(impl, this);
- this.ownerElement_ = ownerElement;
- }
- DOMTokenList.prototype = {
- constructor: DOMTokenList,
- get length() {
- return unsafeUnwrap(this).length;
- },
- item: function(index) {
- return unsafeUnwrap(this).item(index);
- },
- contains: function(token) {
- return unsafeUnwrap(this).contains(token);
- },
- add: function() {
- unsafeUnwrap(this).add.apply(unsafeUnwrap(this), arguments);
- invalidateClass(this.ownerElement_);
- },
- remove: function() {
- unsafeUnwrap(this).remove.apply(unsafeUnwrap(this), arguments);
- invalidateClass(this.ownerElement_);
- },
- toggle: function(token) {
- var rv = unsafeUnwrap(this).toggle.apply(unsafeUnwrap(this), arguments);
- invalidateClass(this.ownerElement_);
- return rv;
- },
- toString: function() {
- return unsafeUnwrap(this).toString();
+ function changeClass(tokenList, method, args) {
+ var ownerElement = tokenList.ownerElement_;
+ if (ownerElement == null) {
+ return method.apply(tokenList, args);
}
+ var oldValue = getClass(ownerElement);
+ var retv = method.apply(tokenList, args);
+ if (getClass(ownerElement) !== oldValue) {
+ enqueueClassAttributeChange(ownerElement, oldValue);
+ invalidateClass(ownerElement);
+ }
+ return retv;
+ }
+ var oldAdd = DOMTokenList.prototype.add;
+ DOMTokenList.prototype.add = function() {
+ changeClass(this, oldAdd, arguments);
+ };
+ var oldRemove = DOMTokenList.prototype.remove;
+ DOMTokenList.prototype.remove = function() {
+ changeClass(this, oldRemove, arguments);
+ };
+ var oldToggle = DOMTokenList.prototype.toggle;
+ DOMTokenList.prototype.toggle = function() {
+ return changeClass(this, oldToggle, arguments);
};
- scope.wrappers.DOMTokenList = DOMTokenList;
})(window.ShadowDOMPolyfill);
(function(scope) {
"use strict";
var ChildNodeInterface = scope.ChildNodeInterface;
var GetElementsByInterface = scope.GetElementsByInterface;
var Node = scope.wrappers.Node;
- var DOMTokenList = scope.wrappers.DOMTokenList;
var ParentNodeInterface = scope.ParentNodeInterface;
var SelectorsInterface = scope.SelectorsInterface;
var addWrapNodeListMethod = scope.addWrapNodeListMethod;
@@ -2435,7 +2435,9 @@ if (WebComponents.flags.shadow) {
get classList() {
var list = classListTable.get(this);
if (!list) {
- classListTable.set(this, list = new DOMTokenList(unsafeUnwrap(this).classList, this));
+ list = unsafeUnwrap(this).classList;
+ list.ownerElement_ = this;
+ classListTable.set(this, list);
}
return list;
},
@@ -4012,7 +4014,8 @@ if (WebComponents.flags.shadow) {
};
forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "registerElement" ]);
}
- forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsByTagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelectorAll", "removeChild", "replaceChild" ].concat(matchesNames));
+ forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsByTagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelectorAll", "removeChild", "replaceChild" ]);
+ forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLHeadElement, window.HTMLHtmlElement ], matchesNames);
forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adoptNode", "importNode", "contains", "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "elementFromPoint", "getElementById", "getElementsByName", "getSelection" ]);
mixin(Document.prototype, GetElementsByInterface);
mixin(Document.prototype, ParentNodeInterface);
@@ -5115,9 +5118,9 @@ window.HTMLImports = window.HTMLImports || {
whenReady(function() {
HTMLImports.ready = true;
HTMLImports.readyTime = new Date().getTime();
- rootDocument.dispatchEvent(new CustomEvent("HTMLImportsLoaded", {
- bubbles: true
- }));
+ var evt = rootDocument.createEvent("CustomEvent");
+ evt.initCustomEvent("HTMLImportsLoaded", true, true, {});
+ rootDocument.dispatchEvent(evt);
});
scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
scope.useNative = useNative;
@@ -5168,7 +5171,7 @@ HTMLImports.addModule(function(scope) {
});
HTMLImports.addModule(function(scope) {
- xhr = {
+ var xhr = {
async: true,
ok: function(request) {
return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
@@ -5245,7 +5248,13 @@ HTMLImports.addModule(function(scope) {
},
fetch: function(url, elt) {
flags.load && console.log("fetch", url, elt);
- if (url.match(/^data:/)) {
+ if (!url) {
+ setTimeout(function() {
+ this.receive(url, elt, {
+ error: "href must be specified"
+ }, null);
+ }.bind(this), 0);
+ } else if (url.match(/^data:/)) {
var pieces = url.split(",");
var header = pieces[0];
var body = pieces[1];
@@ -5649,7 +5658,7 @@ HTMLImports.addModule(function(scope) {
var importer = scope.importer;
var dynamic = {
added: function(nodes) {
- var owner, parsed;
+ var owner, parsed, loading;
for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
if (!owner) {
owner = n.ownerDocument;

Powered by Google App Engine
This is Rietveld 408576698