From fadd455e0d464e83dfc53b2645322948721965fc Mon Sep 17 00:00:00 2001 From: Eric Bidelman Date: Mon, 30 Nov 2015 14:55:47 -0800 Subject: [PATCH] Fixes #3113 --- src/standard/utils.html | 22 ++++++++++++------ test/unit/dynamic-import.html | 23 ++++++++++++++++++- .../unit/dynamic-imports/dynamic-element.html | 6 ++--- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/standard/utils.html b/src/standard/utils.html index 84528710..8f8f5fe9 100644 --- a/src/standard/utils.html +++ b/src/standard/utils.html @@ -164,7 +164,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN /** * Returns a list of nodes distributed to this element's ``. * - * If this element contans more than one `` in its local DOM, + * If this element contains more than one `` in its local DOM, * an optional selector may be passed to choose the desired content. * * @method getContentChildNodes @@ -181,7 +181,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * Returns a list of element children distributed to this element's * ``. * - * If this element contans more than one `` in its + * If this element contains more than one `` in its * local DOM, an optional selector may be passed to choose the desired * content. This method differs from `getContentChildNodes` in that only * elements are returned. @@ -198,7 +198,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN }); }, - + /** * Dispatches a custom event with an optional detail value. * @@ -234,13 +234,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN __eventCache: {}, // NOTE: We optionally cache event objects for efficiency during high - // freq. opts. This option cannot be used for events which may have + // freq. opts. This option cannot be used for events which may have // `stopPropagation` called on them. On Chrome and Safari (but not FF) - // if `stopPropagation` is called, the event cannot be reused. It does not + // if `stopPropagation` is called, the event cannot be reused. It does not // dispatch again. _getEvent: function(type, bubbles, cancelable, useCache) { var event = useCache && this.__eventCache[type]; - if (!event || ((event.bubbles != bubbles) || + if (!event || ((event.bubbles != bubbles) || (event.cancelable != cancelable))) { event = new Event(type, { bubbles: Boolean(bubbles), @@ -358,12 +358,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * loaded. * @param {Function} onerror Callback to notify when an import * unsuccessfully loaded. + * @param {boolean} optAsync True if the import should be loaded `async`. + * Defaults to `false`. * @return {HTMLLinkElement} The link element for the URL to be loaded. */ - importHref: function(href, onload, onerror) { + importHref: function(href, onload, onerror, optAsync) { var l = document.createElement('link'); l.rel = 'import'; l.href = href; + + optAsync = Boolean(optAsync); + if (optAsync) { + l.setAttribute('async', ''); + } + var self = this; if (onload) { l.onload = function(e) { diff --git a/test/unit/dynamic-import.html b/test/unit/dynamic-import.html index 983f05a4..c4c94588 100644 --- a/test/unit/dynamic-import.html +++ b/test/unit/dynamic-import.html @@ -20,7 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN diff --git a/test/unit/dynamic-imports/dynamic-element.html b/test/unit/dynamic-imports/dynamic-element.html index 7b5b1467..3233e3fb 100644 --- a/test/unit/dynamic-imports/dynamic-element.html +++ b/test/unit/dynamic-imports/dynamic-element.html @@ -12,12 +12,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN \ No newline at end of file +