| Index: pkg/web_components/lib/platform.concat.js
|
| diff --git a/pkg/web_components/lib/platform.concat.js b/pkg/web_components/lib/platform.concat.js
|
| index c4407a2a52284e9023072bf64672016794c062ef..6eea86858eae0662dae51b4d21570024a9388a2c 100644
|
| --- a/pkg/web_components/lib/platform.concat.js
|
| +++ b/pkg/web_components/lib/platform.concat.js
|
| @@ -1840,8 +1840,8 @@ if (typeof WeakMap === 'undefined') {
|
| global.ObserverTransform = ObserverTransform;
|
| })(typeof global !== 'undefined' && global && typeof module !== 'undefined' && module ? global : this || window);
|
|
|
| -// select ShadowDOM impl
|
| -if (Platform.flags.shadow) {
|
| +// select ShadowDOM impl
|
| +if (Platform.flags.shadow) {
|
|
|
| // Copyright 2012 The Polymer Authors. All rights reserved.
|
| // Use of this source code is goverened by a BSD-style
|
| @@ -7791,6 +7791,7 @@ window.ShadowDOMPolyfill = {};
|
|
|
| // Work around for https://bugzilla.mozilla.org/show_bug.cgi?id=943065
|
| delete window.getComputedStyle;
|
| + delete window.getDefaultComputedStyle;
|
| delete window.getSelection;
|
|
|
| ['addEventListener', 'removeEventListener', 'dispatchEvent'].forEach(
|
| @@ -11720,353 +11721,353 @@ if (!HTMLImports.useNative) {
|
| * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
| */
|
| window.CustomElements = window.CustomElements || {flags:{}};
|
| -/*
|
| - * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
| - * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| - * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| - * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| - * 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
|
| - */
|
| -
|
| -(function(scope){
|
| -
|
| -var logFlags = window.logFlags || {};
|
| -var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : 'none';
|
| -
|
| -// walk the subtree rooted at node, applying 'find(element, data)' function
|
| -// to each element
|
| -// if 'find' returns true for 'element', do not search element's subtree
|
| -function findAll(node, find, data) {
|
| - var e = node.firstElementChild;
|
| - if (!e) {
|
| - e = node.firstChild;
|
| - while (e && e.nodeType !== Node.ELEMENT_NODE) {
|
| - e = e.nextSibling;
|
| - }
|
| - }
|
| - while (e) {
|
| - if (find(e, data) !== true) {
|
| - findAll(e, find, data);
|
| - }
|
| - e = e.nextElementSibling;
|
| - }
|
| - return null;
|
| -}
|
| -
|
| -// walk all shadowRoots on a given node.
|
| -function forRoots(node, cb) {
|
| - var root = node.shadowRoot;
|
| - while(root) {
|
| - forSubtree(root, cb);
|
| - root = root.olderShadowRoot;
|
| - }
|
| -}
|
| -
|
| -// walk the subtree rooted at node, including descent into shadow-roots,
|
| -// applying 'cb' to each element
|
| -function forSubtree(node, cb) {
|
| - //logFlags.dom && node.childNodes && node.childNodes.length && console.group('subTree: ', node);
|
| - findAll(node, function(e) {
|
| - if (cb(e)) {
|
| - return true;
|
| - }
|
| - forRoots(e, cb);
|
| - });
|
| - forRoots(node, cb);
|
| - //logFlags.dom && node.childNodes && node.childNodes.length && console.groupEnd();
|
| -}
|
| -
|
| -// manage lifecycle on added node
|
| -function added(node) {
|
| - if (upgrade(node)) {
|
| - insertedNode(node);
|
| - return true;
|
| - }
|
| - inserted(node);
|
| -}
|
| -
|
| -// manage lifecycle on added node's subtree only
|
| -function addedSubtree(node) {
|
| - forSubtree(node, function(e) {
|
| - if (added(e)) {
|
| - return true;
|
| - }
|
| - });
|
| -}
|
| -
|
| -// manage lifecycle on added node and it's subtree
|
| -function addedNode(node) {
|
| - return added(node) || addedSubtree(node);
|
| -}
|
| -
|
| -// upgrade custom elements at node, if applicable
|
| -function upgrade(node) {
|
| - if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
| - var type = node.getAttribute('is') || node.localName;
|
| - var definition = scope.registry[type];
|
| - if (definition) {
|
| - logFlags.dom && console.group('upgrade:', node.localName);
|
| - scope.upgrade(node);
|
| - logFlags.dom && console.groupEnd();
|
| - return true;
|
| - }
|
| - }
|
| -}
|
| -
|
| -function insertedNode(node) {
|
| - inserted(node);
|
| - if (inDocument(node)) {
|
| - forSubtree(node, function(e) {
|
| - inserted(e);
|
| - });
|
| - }
|
| -}
|
| -
|
| -// TODO(sorvell): on platforms without MutationObserver, mutations may not be
|
| -// reliable and therefore attached/detached are not reliable.
|
| -// To make these callbacks less likely to fail, we defer all inserts and removes
|
| -// to give a chance for elements to be inserted into dom.
|
| -// This ensures attachedCallback fires for elements that are created and
|
| -// immediately added to dom.
|
| -var hasPolyfillMutations = (!window.MutationObserver ||
|
| - (window.MutationObserver === window.JsMutationObserver));
|
| -scope.hasPolyfillMutations = hasPolyfillMutations;
|
| -
|
| -var isPendingMutations = false;
|
| -var pendingMutations = [];
|
| -function deferMutation(fn) {
|
| - pendingMutations.push(fn);
|
| - if (!isPendingMutations) {
|
| - isPendingMutations = true;
|
| - var async = (window.Platform && window.Platform.endOfMicrotask) ||
|
| - setTimeout;
|
| - async(takeMutations);
|
| - }
|
| -}
|
| -
|
| -function takeMutations() {
|
| - isPendingMutations = false;
|
| - var $p = pendingMutations;
|
| - for (var i=0, l=$p.length, p; (i<l) && (p=$p[i]); i++) {
|
| - p();
|
| - }
|
| - pendingMutations = [];
|
| -}
|
| -
|
| -function inserted(element) {
|
| - if (hasPolyfillMutations) {
|
| - deferMutation(function() {
|
| - _inserted(element);
|
| - });
|
| - } else {
|
| - _inserted(element);
|
| - }
|
| -}
|
| -
|
| -// TODO(sjmiles): if there are descents into trees that can never have inDocument(*) true, fix this
|
| -function _inserted(element) {
|
| - // TODO(sjmiles): it's possible we were inserted and removed in the space
|
| - // of one microtask, in which case we won't be 'inDocument' here
|
| - // But there are other cases where we are testing for inserted without
|
| - // specific knowledge of mutations, and must test 'inDocument' to determine
|
| - // whether to call inserted
|
| - // If we can factor these cases into separate code paths we can have
|
| - // better diagnostics.
|
| - // TODO(sjmiles): when logging, do work on all custom elements so we can
|
| - // track behavior even when callbacks not defined
|
| - //console.log('inserted: ', element.localName);
|
| - if (element.attachedCallback || element.detachedCallback || (element.__upgraded__ && logFlags.dom)) {
|
| - logFlags.dom && console.group('inserted:', element.localName);
|
| - if (inDocument(element)) {
|
| - element.__inserted = (element.__inserted || 0) + 1;
|
| - // if we are in a 'removed' state, bluntly adjust to an 'inserted' state
|
| - if (element.__inserted < 1) {
|
| - element.__inserted = 1;
|
| - }
|
| - // if we are 'over inserted', squelch the callback
|
| - if (element.__inserted > 1) {
|
| - logFlags.dom && console.warn('inserted:', element.localName,
|
| - 'insert/remove count:', element.__inserted)
|
| - } else if (element.attachedCallback) {
|
| - logFlags.dom && console.log('inserted:', element.localName);
|
| - element.attachedCallback();
|
| - }
|
| - }
|
| - logFlags.dom && console.groupEnd();
|
| - }
|
| -}
|
| -
|
| -function removedNode(node) {
|
| - removed(node);
|
| - forSubtree(node, function(e) {
|
| - removed(e);
|
| - });
|
| -}
|
| -
|
| -function removed(element) {
|
| - if (hasPolyfillMutations) {
|
| - deferMutation(function() {
|
| - _removed(element);
|
| - });
|
| - } else {
|
| - _removed(element);
|
| - }
|
| -}
|
| -
|
| -function _removed(element) {
|
| - // TODO(sjmiles): temporary: do work on all custom elements so we can track
|
| - // behavior even when callbacks not defined
|
| - if (element.attachedCallback || element.detachedCallback || (element.__upgraded__ && logFlags.dom)) {
|
| - logFlags.dom && console.group('removed:', element.localName);
|
| - if (!inDocument(element)) {
|
| - element.__inserted = (element.__inserted || 0) - 1;
|
| - // if we are in a 'inserted' state, bluntly adjust to an 'removed' state
|
| - if (element.__inserted > 0) {
|
| - element.__inserted = 0;
|
| - }
|
| - // if we are 'over removed', squelch the callback
|
| - if (element.__inserted < 0) {
|
| - logFlags.dom && console.warn('removed:', element.localName,
|
| - 'insert/remove count:', element.__inserted)
|
| - } else if (element.detachedCallback) {
|
| - element.detachedCallback();
|
| - }
|
| - }
|
| - logFlags.dom && console.groupEnd();
|
| - }
|
| -}
|
| -
|
| -// SD polyfill intrustion due mainly to the fact that 'document'
|
| -// is not entirely wrapped
|
| -function wrapIfNeeded(node) {
|
| - return window.ShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node)
|
| - : node;
|
| -}
|
| -
|
| -function inDocument(element) {
|
| - var p = element;
|
| - var doc = wrapIfNeeded(document);
|
| - while (p) {
|
| - if (p == doc) {
|
| - return true;
|
| - }
|
| - p = p.parentNode || p.host;
|
| - }
|
| -}
|
| -
|
| -function watchShadow(node) {
|
| - if (node.shadowRoot && !node.shadowRoot.__watched) {
|
| - logFlags.dom && console.log('watching shadow-root for: ', node.localName);
|
| - // watch all unwatched roots...
|
| - var root = node.shadowRoot;
|
| - while (root) {
|
| - watchRoot(root);
|
| - root = root.olderShadowRoot;
|
| - }
|
| - }
|
| -}
|
| -
|
| -function watchRoot(root) {
|
| - if (!root.__watched) {
|
| - observe(root);
|
| - root.__watched = true;
|
| - }
|
| -}
|
| -
|
| -function handler(mutations) {
|
| - //
|
| - if (logFlags.dom) {
|
| - var mx = mutations[0];
|
| - if (mx && mx.type === 'childList' && mx.addedNodes) {
|
| - if (mx.addedNodes) {
|
| - var d = mx.addedNodes[0];
|
| - while (d && d !== document && !d.host) {
|
| - d = d.parentNode;
|
| - }
|
| - var u = d && (d.URL || d._URL || (d.host && d.host.localName)) || '';
|
| - u = u.split('/?').shift().split('/').pop();
|
| - }
|
| - }
|
| - console.group('mutations (%d) [%s]', mutations.length, u || '');
|
| - }
|
| - //
|
| - mutations.forEach(function(mx) {
|
| - //logFlags.dom && console.group('mutation');
|
| - if (mx.type === 'childList') {
|
| - forEach(mx.addedNodes, function(n) {
|
| - //logFlags.dom && console.log(n.localName);
|
| - if (!n.localName) {
|
| - return;
|
| - }
|
| - // nodes added may need lifecycle management
|
| - addedNode(n);
|
| - });
|
| - // removed nodes may need lifecycle management
|
| - forEach(mx.removedNodes, function(n) {
|
| - //logFlags.dom && console.log(n.localName);
|
| - if (!n.localName) {
|
| - return;
|
| - }
|
| - removedNode(n);
|
| - });
|
| - }
|
| - //logFlags.dom && console.groupEnd();
|
| - });
|
| - logFlags.dom && console.groupEnd();
|
| -};
|
| -
|
| -var observer = new MutationObserver(handler);
|
| -
|
| -function takeRecords() {
|
| - // TODO(sjmiles): ask Raf why we have to call handler ourselves
|
| - handler(observer.takeRecords());
|
| - takeMutations();
|
| -}
|
| -
|
| -var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
| -
|
| -function observe(inRoot) {
|
| - observer.observe(inRoot, {childList: true, subtree: true});
|
| -}
|
| -
|
| -function observeDocument(doc) {
|
| - observe(doc);
|
| -}
|
| -
|
| -function upgradeDocument(doc) {
|
| - logFlags.dom && console.group('upgradeDocument: ', (doc.baseURI).split('/').pop());
|
| - addedNode(doc);
|
| - logFlags.dom && console.groupEnd();
|
| -}
|
| -
|
| -function upgradeDocumentTree(doc) {
|
| - doc = wrapIfNeeded(doc);
|
| - //console.log('upgradeDocumentTree: ', (doc.baseURI).split('/').pop());
|
| - // upgrade contained imported documents
|
| - var imports = doc.querySelectorAll('link[rel=' + IMPORT_LINK_TYPE + ']');
|
| - for (var i=0, l=imports.length, n; (i<l) && (n=imports[i]); i++) {
|
| - if (n.import && n.import.__parsed) {
|
| - upgradeDocumentTree(n.import);
|
| - }
|
| - }
|
| - upgradeDocument(doc);
|
| -}
|
| -
|
| -// exports
|
| -scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
|
| -scope.watchShadow = watchShadow;
|
| -scope.upgradeDocumentTree = upgradeDocumentTree;
|
| -scope.upgradeAll = addedNode;
|
| -scope.upgradeSubtree = addedSubtree;
|
| -scope.insertedNode = insertedNode;
|
| -
|
| -scope.observeDocument = observeDocument;
|
| -scope.upgradeDocument = upgradeDocument;
|
| -
|
| -scope.takeRecords = takeRecords;
|
| -
|
| -})(window.CustomElements);
|
| +/*
|
| + * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
| + * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
| + * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
| + * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
| + * 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
|
| + */
|
| +
|
| +(function(scope){
|
| +
|
| +var logFlags = window.logFlags || {};
|
| +var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : 'none';
|
| +
|
| +// walk the subtree rooted at node, applying 'find(element, data)' function
|
| +// to each element
|
| +// if 'find' returns true for 'element', do not search element's subtree
|
| +function findAll(node, find, data) {
|
| + var e = node.firstElementChild;
|
| + if (!e) {
|
| + e = node.firstChild;
|
| + while (e && e.nodeType !== Node.ELEMENT_NODE) {
|
| + e = e.nextSibling;
|
| + }
|
| + }
|
| + while (e) {
|
| + if (find(e, data) !== true) {
|
| + findAll(e, find, data);
|
| + }
|
| + e = e.nextElementSibling;
|
| + }
|
| + return null;
|
| +}
|
| +
|
| +// walk all shadowRoots on a given node.
|
| +function forRoots(node, cb) {
|
| + var root = node.shadowRoot;
|
| + while(root) {
|
| + forSubtree(root, cb);
|
| + root = root.olderShadowRoot;
|
| + }
|
| +}
|
| +
|
| +// walk the subtree rooted at node, including descent into shadow-roots,
|
| +// applying 'cb' to each element
|
| +function forSubtree(node, cb) {
|
| + //logFlags.dom && node.childNodes && node.childNodes.length && console.group('subTree: ', node);
|
| + findAll(node, function(e) {
|
| + if (cb(e)) {
|
| + return true;
|
| + }
|
| + forRoots(e, cb);
|
| + });
|
| + forRoots(node, cb);
|
| + //logFlags.dom && node.childNodes && node.childNodes.length && console.groupEnd();
|
| +}
|
| +
|
| +// manage lifecycle on added node
|
| +function added(node) {
|
| + if (upgrade(node)) {
|
| + insertedNode(node);
|
| + return true;
|
| + }
|
| + inserted(node);
|
| +}
|
| +
|
| +// manage lifecycle on added node's subtree only
|
| +function addedSubtree(node) {
|
| + forSubtree(node, function(e) {
|
| + if (added(e)) {
|
| + return true;
|
| + }
|
| + });
|
| +}
|
| +
|
| +// manage lifecycle on added node and it's subtree
|
| +function addedNode(node) {
|
| + return added(node) || addedSubtree(node);
|
| +}
|
| +
|
| +// upgrade custom elements at node, if applicable
|
| +function upgrade(node) {
|
| + if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
| + var type = node.getAttribute('is') || node.localName;
|
| + var definition = scope.registry[type];
|
| + if (definition) {
|
| + logFlags.dom && console.group('upgrade:', node.localName);
|
| + scope.upgrade(node);
|
| + logFlags.dom && console.groupEnd();
|
| + return true;
|
| + }
|
| + }
|
| +}
|
| +
|
| +function insertedNode(node) {
|
| + inserted(node);
|
| + if (inDocument(node)) {
|
| + forSubtree(node, function(e) {
|
| + inserted(e);
|
| + });
|
| + }
|
| +}
|
| +
|
| +// TODO(sorvell): on platforms without MutationObserver, mutations may not be
|
| +// reliable and therefore attached/detached are not reliable.
|
| +// To make these callbacks less likely to fail, we defer all inserts and removes
|
| +// to give a chance for elements to be inserted into dom.
|
| +// This ensures attachedCallback fires for elements that are created and
|
| +// immediately added to dom.
|
| +var hasPolyfillMutations = (!window.MutationObserver ||
|
| + (window.MutationObserver === window.JsMutationObserver));
|
| +scope.hasPolyfillMutations = hasPolyfillMutations;
|
| +
|
| +var isPendingMutations = false;
|
| +var pendingMutations = [];
|
| +function deferMutation(fn) {
|
| + pendingMutations.push(fn);
|
| + if (!isPendingMutations) {
|
| + isPendingMutations = true;
|
| + var async = (window.Platform && window.Platform.endOfMicrotask) ||
|
| + setTimeout;
|
| + async(takeMutations);
|
| + }
|
| +}
|
| +
|
| +function takeMutations() {
|
| + isPendingMutations = false;
|
| + var $p = pendingMutations;
|
| + for (var i=0, l=$p.length, p; (i<l) && (p=$p[i]); i++) {
|
| + p();
|
| + }
|
| + pendingMutations = [];
|
| +}
|
| +
|
| +function inserted(element) {
|
| + if (hasPolyfillMutations) {
|
| + deferMutation(function() {
|
| + _inserted(element);
|
| + });
|
| + } else {
|
| + _inserted(element);
|
| + }
|
| +}
|
| +
|
| +// TODO(sjmiles): if there are descents into trees that can never have inDocument(*) true, fix this
|
| +function _inserted(element) {
|
| + // TODO(sjmiles): it's possible we were inserted and removed in the space
|
| + // of one microtask, in which case we won't be 'inDocument' here
|
| + // But there are other cases where we are testing for inserted without
|
| + // specific knowledge of mutations, and must test 'inDocument' to determine
|
| + // whether to call inserted
|
| + // If we can factor these cases into separate code paths we can have
|
| + // better diagnostics.
|
| + // TODO(sjmiles): when logging, do work on all custom elements so we can
|
| + // track behavior even when callbacks not defined
|
| + //console.log('inserted: ', element.localName);
|
| + if (element.attachedCallback || element.detachedCallback || (element.__upgraded__ && logFlags.dom)) {
|
| + logFlags.dom && console.group('inserted:', element.localName);
|
| + if (inDocument(element)) {
|
| + element.__inserted = (element.__inserted || 0) + 1;
|
| + // if we are in a 'removed' state, bluntly adjust to an 'inserted' state
|
| + if (element.__inserted < 1) {
|
| + element.__inserted = 1;
|
| + }
|
| + // if we are 'over inserted', squelch the callback
|
| + if (element.__inserted > 1) {
|
| + logFlags.dom && console.warn('inserted:', element.localName,
|
| + 'insert/remove count:', element.__inserted)
|
| + } else if (element.attachedCallback) {
|
| + logFlags.dom && console.log('inserted:', element.localName);
|
| + element.attachedCallback();
|
| + }
|
| + }
|
| + logFlags.dom && console.groupEnd();
|
| + }
|
| +}
|
| +
|
| +function removedNode(node) {
|
| + removed(node);
|
| + forSubtree(node, function(e) {
|
| + removed(e);
|
| + });
|
| +}
|
| +
|
| +function removed(element) {
|
| + if (hasPolyfillMutations) {
|
| + deferMutation(function() {
|
| + _removed(element);
|
| + });
|
| + } else {
|
| + _removed(element);
|
| + }
|
| +}
|
| +
|
| +function _removed(element) {
|
| + // TODO(sjmiles): temporary: do work on all custom elements so we can track
|
| + // behavior even when callbacks not defined
|
| + if (element.attachedCallback || element.detachedCallback || (element.__upgraded__ && logFlags.dom)) {
|
| + logFlags.dom && console.group('removed:', element.localName);
|
| + if (!inDocument(element)) {
|
| + element.__inserted = (element.__inserted || 0) - 1;
|
| + // if we are in a 'inserted' state, bluntly adjust to an 'removed' state
|
| + if (element.__inserted > 0) {
|
| + element.__inserted = 0;
|
| + }
|
| + // if we are 'over removed', squelch the callback
|
| + if (element.__inserted < 0) {
|
| + logFlags.dom && console.warn('removed:', element.localName,
|
| + 'insert/remove count:', element.__inserted)
|
| + } else if (element.detachedCallback) {
|
| + element.detachedCallback();
|
| + }
|
| + }
|
| + logFlags.dom && console.groupEnd();
|
| + }
|
| +}
|
| +
|
| +// SD polyfill intrustion due mainly to the fact that 'document'
|
| +// is not entirely wrapped
|
| +function wrapIfNeeded(node) {
|
| + return window.ShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node)
|
| + : node;
|
| +}
|
| +
|
| +function inDocument(element) {
|
| + var p = element;
|
| + var doc = wrapIfNeeded(document);
|
| + while (p) {
|
| + if (p == doc) {
|
| + return true;
|
| + }
|
| + p = p.parentNode || p.host;
|
| + }
|
| +}
|
| +
|
| +function watchShadow(node) {
|
| + if (node.shadowRoot && !node.shadowRoot.__watched) {
|
| + logFlags.dom && console.log('watching shadow-root for: ', node.localName);
|
| + // watch all unwatched roots...
|
| + var root = node.shadowRoot;
|
| + while (root) {
|
| + watchRoot(root);
|
| + root = root.olderShadowRoot;
|
| + }
|
| + }
|
| +}
|
| +
|
| +function watchRoot(root) {
|
| + if (!root.__watched) {
|
| + observe(root);
|
| + root.__watched = true;
|
| + }
|
| +}
|
| +
|
| +function handler(mutations) {
|
| + //
|
| + if (logFlags.dom) {
|
| + var mx = mutations[0];
|
| + if (mx && mx.type === 'childList' && mx.addedNodes) {
|
| + if (mx.addedNodes) {
|
| + var d = mx.addedNodes[0];
|
| + while (d && d !== document && !d.host) {
|
| + d = d.parentNode;
|
| + }
|
| + var u = d && (d.URL || d._URL || (d.host && d.host.localName)) || '';
|
| + u = u.split('/?').shift().split('/').pop();
|
| + }
|
| + }
|
| + console.group('mutations (%d) [%s]', mutations.length, u || '');
|
| + }
|
| + //
|
| + mutations.forEach(function(mx) {
|
| + //logFlags.dom && console.group('mutation');
|
| + if (mx.type === 'childList') {
|
| + forEach(mx.addedNodes, function(n) {
|
| + //logFlags.dom && console.log(n.localName);
|
| + if (!n.localName) {
|
| + return;
|
| + }
|
| + // nodes added may need lifecycle management
|
| + addedNode(n);
|
| + });
|
| + // removed nodes may need lifecycle management
|
| + forEach(mx.removedNodes, function(n) {
|
| + //logFlags.dom && console.log(n.localName);
|
| + if (!n.localName) {
|
| + return;
|
| + }
|
| + removedNode(n);
|
| + });
|
| + }
|
| + //logFlags.dom && console.groupEnd();
|
| + });
|
| + logFlags.dom && console.groupEnd();
|
| +};
|
| +
|
| +var observer = new MutationObserver(handler);
|
| +
|
| +function takeRecords() {
|
| + // TODO(sjmiles): ask Raf why we have to call handler ourselves
|
| + handler(observer.takeRecords());
|
| + takeMutations();
|
| +}
|
| +
|
| +var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
|
| +
|
| +function observe(inRoot) {
|
| + observer.observe(inRoot, {childList: true, subtree: true});
|
| +}
|
| +
|
| +function observeDocument(doc) {
|
| + observe(doc);
|
| +}
|
| +
|
| +function upgradeDocument(doc) {
|
| + logFlags.dom && console.group('upgradeDocument: ', (doc.baseURI).split('/').pop());
|
| + addedNode(doc);
|
| + logFlags.dom && console.groupEnd();
|
| +}
|
| +
|
| +function upgradeDocumentTree(doc) {
|
| + doc = wrapIfNeeded(doc);
|
| + //console.log('upgradeDocumentTree: ', (doc.baseURI).split('/').pop());
|
| + // upgrade contained imported documents
|
| + var imports = doc.querySelectorAll('link[rel=' + IMPORT_LINK_TYPE + ']');
|
| + for (var i=0, l=imports.length, n; (i<l) && (n=imports[i]); i++) {
|
| + if (n.import && n.import.__parsed) {
|
| + upgradeDocumentTree(n.import);
|
| + }
|
| + }
|
| + upgradeDocument(doc);
|
| +}
|
| +
|
| +// exports
|
| +scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
|
| +scope.watchShadow = watchShadow;
|
| +scope.upgradeDocumentTree = upgradeDocumentTree;
|
| +scope.upgradeAll = addedNode;
|
| +scope.upgradeSubtree = addedSubtree;
|
| +scope.insertedNode = insertedNode;
|
| +
|
| +scope.observeDocument = observeDocument;
|
| +scope.upgradeDocument = upgradeDocument;
|
| +
|
| +scope.takeRecords = takeRecords;
|
| +
|
| +})(window.CustomElements);
|
|
|
| /*
|
| * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
| @@ -14596,4 +14597,4 @@ scope.flush = flush;
|
| })(window.Platform);
|
|
|
|
|
| -//# sourceMappingURL=platform.concat.js.map
|
| +//# sourceMappingURL=platform.concat.js.map
|
|
|