From e90fc863cf39563f4153da405bb728237dd056d0 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Thu, 12 Jan 2017 15:55:12 -0800 Subject: [PATCH] only warnings are for mixins, which is not implemented --- externs/externs.js | 65 +++++++++++--- gulpfile.js | 30 +++---- src/attributes/attributes.html | 41 +++++---- src/elements/element.html | 20 ++++- src/elements/legacy-element.html | 22 ++--- src/events/gesture-event-listeners.html | 3 + src/legacy/class.html | 8 ++ src/legacy/dom-module.html | 15 ++-- src/properties/property-accessors.html | 4 +- src/properties/property-effects.html | 108 ++++++++++++++---------- src/styling/style-gather.html | 5 ++ src/template/annotations.html | 2 +- src/templatizer/dom-repeat.html | 16 ++-- src/templatizer/templatizer.html | 6 +- src/utils/case-map.html | 5 +- src/utils/debounce.html | 74 +++++++++------- src/utils/path.html | 18 +++- src/utils/polymer.dom.html | 5 ++ src/utils/unresolved.html | 4 +- src/utils/utils.html | 13 ++- 20 files changed, 306 insertions(+), 158 deletions(-) diff --git a/externs/externs.js b/externs/externs.js index c6d2a3db..c9d7b1ed 100644 --- a/externs/externs.js +++ b/externs/externs.js @@ -1,4 +1,5 @@ window.Polymer = {}; + function Polymer(){} let customElements = { @@ -14,8 +15,6 @@ let HTMLImports = { window.HTMLImports = HTMLImports; -let addEventListener = window.addEventListener; - let ShadyCSS = { applyStyle(){}, updateStyles(){}, @@ -39,12 +38,25 @@ window.ShadyDOM = ShadyDOM; let WebComponents = {}; window.WebComponents = WebComponents; -Event.prototype.composed = false; - -HTMLElement.prototype.attachShadow = function(){}; +/** + * @type {boolean} + */ +Event.prototype.composed; /** - * @record + * @return {!Array} + */ +Event.prototype.composedPath = function(){}; + +/** + * @param {!{mode: string}} options + * @return {!ShadowRoot} + */ +HTMLElement.prototype.attachShadow = function(options){}; + +/** + * @constructor + * @extends {HTMLElement} */ function CustomStyle(){} /** @@ -57,13 +69,13 @@ CustomStyle.prototype.processHook = function(style){}; */ function CustomElement(){} /** - * @type {Array | undefined} + * @type {!Array | undefined} */ CustomElement.observedAttributes; CustomElement.prototype.connectedCallback = function(){}; CustomElement.prototype.disconnectedCallback = function(){}; /** - * @param {!string} attributeName + * @param {string} attributeName * @param {?string} oldValue * @param {?string} newValue * @param {?string} namespaceURI @@ -72,12 +84,41 @@ CustomElement.prototype.attributeChangedCallback = function(attributeName, oldVa /** * @constructor - * @extends HTMLElement + * @extends {HTMLElement} */ function HTMLSlotElement(){} /** - * @param {{flatten: boolean} | undefined} options - * @return {Array} + * @param {!{flatten: boolean} | undefined} options + * @return {!Array} */ -HTMLSlotElement.prototype.assignedNodes = function(options){}; \ No newline at end of file +HTMLSlotElement.prototype.assignedNodes = function(options){}; + +/** + * @type {HTMLSlotElement} + */ +Node.prototype.assignedSlot; + +/** + * @constructor + */ +function InputDeviceCapabilities(){} +/** + * @type {boolean} + */ +InputDeviceCapabilities.prototype.firesTouchEvents; + +/** + * @type {InputDeviceCapabilities} + */ +MouseEvent.prototype.sourceCapabilities; + +/** + * @type {Element} + */ +HTMLElement.prototype._activeElement; + +/** + * @param {HTMLTemplateElement} template + */ +HTMLTemplateElement.prototype.decorate = function(template){}; \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 9bb524a4..65000741 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -55,36 +55,27 @@ gulp.task('clean', function () { const {Transform} = require('stream'); -class LogStream extends Transform { - constructor(prefix) { - super({objectMode: true}); - this.prefix = `${prefix || ''}:`; - } - _transform(file, enc, cb) { - console.log(this.prefix, file.path); - cb(null, file); - } -} - class OldNameStream extends Transform { - constructor(closureStream) { + constructor(fileList) { super({objectMode: true}); - this.fileList = closureStream.fileList_; + this.fileList = fileList; } _transform(file, enc, cb) { - const origFile = this.fileList.shift(); - // console.log(`rename ${file.path} -> ${origFile.path}`) - file.path = origFile.path; + if (this.fileList) { + const origFile = this.fileList.shift(); + // console.log(`rename ${file.path} -> ${origFile.path}`) + file.path = origFile.path; + } cb(null, file); } _flush(cb) { - if (this.fileList.length > 0) { + if (this.fileList && this.fileList.length > 0) { this.fileList.forEach((oldFile) => { // console.log(`pumping fake file ${oldFile.path}`) let newFile = oldFile.clone({deep: true, contents: false}); newFile.contents = new Buffer(''); this.push(newFile); - }) + }); } cb(); } @@ -93,6 +84,7 @@ class OldNameStream extends Transform { gulp.task('build', ['clean'], () => { const closureStream = closure({ + // debug: true, // new_type_inf: true, compilation_level: 'ADVANCED', // compilation_level: 'SIMPLE', @@ -107,7 +99,7 @@ gulp.task('build', ['clean'], () => { const closurePipeline = lazypipe() .pipe(() => closureStream) - .pipe(() => new OldNameStream(closureStream)) + .pipe(() => new OldNameStream(closureStream.fileList_)) // process source files in the project const sources = project.sources() diff --git a/src/attributes/attributes.html b/src/attributes/attributes.html index ffafbc61..87d6cacf 100644 --- a/src/attributes/attributes.html +++ b/src/attributes/attributes.html @@ -20,7 +20,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN Polymer.Attributes = Polymer.Utils.dedupingMixin(function(superClass) { - return class Attributes extends superClass { + /** + * @unrestricted + */ + class Attributes extends superClass { constructor() { super(); @@ -66,7 +69,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * * @method _propertyToAttribute * @param {string} property Property name to reflect. - * @param {*=} attribute Attribute name to reflect. + * @param {string=} attribute Attribute name to reflect. * @param {*=} value Property value to refect. */ _propertyToAttribute(property, attribute, value) { @@ -85,11 +88,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * the attribute will be removed (this is the default for boolean * type `false`). * - * @method _valueToAttribute - * @param {Element=} node Element to set attribute to. + * @method _valueToNodeAttribute + * @param {Element} node Element to set attribute to. * @param {*} value Value to serialize. * @param {string} attribute Attribute name to serialize to. - */ _valueToNodeAttribute(node, value, attribute) { var str = this._serializeAttribute(value); @@ -109,7 +111,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * * @method _serializeAttribute * @param {*} value Property value to serialize. - * @return {string} String serialized from the provided property value. + * @return {string | undefined} String serialized from the provided property value. */ _serializeAttribute(value) { /* eslint-disable no-fallthrough */ @@ -119,7 +121,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN case 'object': if (value instanceof Date) { - return value; + return value.toString(); } else if (value) { try { return JSON.stringify(value); @@ -129,7 +131,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } default: - return value != null ? value : undefined; + return value != null ? value.toString() : undefined; } } @@ -152,18 +154,22 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * @return {*} Typed value deserialized from the provided string. */ _deserializeAttribute(value, type) { + /** + * @type {*} + */ + let outValue; switch (type) { case Number: - value = Number(value); + outValue = Number(value); break; case Boolean: - value = (value !== null); + outValue = (value !== null); break; case Object: try { - value = JSON.parse(value); + outValue = JSON.parse(value); } catch(x) { // allow non-JSON literals like Strings and Numbers } @@ -171,26 +177,31 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN case Array: try { - value = JSON.parse(value); + outValue = JSON.parse(value); } catch(x) { - value = null; + outValue = null; console.warn('Polymer::Attributes: couldn`t decode Array as JSON'); } break; case Date: - value = new Date(value); + outValue = new Date(value); break; case String: default: break; } - return value; + + if (!outValue) { + outValue = value; + } + return outValue; } /* eslint-enable no-fallthrough */ } + return Attributes; }); diff --git a/src/elements/element.html b/src/elements/element.html index a681656a..ac13be67 100644 --- a/src/elements/element.html +++ b/src/elements/element.html @@ -40,7 +40,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN Polymer.ElementMixin = Polymer.Utils.cachingMixin(function(base) { const mixin = Polymer.PropertyEffects(base); - return class PolymerElement extends mixin { + + /** + * @unrestricted + */ + class PolymerElement extends mixin { // returns the config object on specifically on `this` class (not super) // config is used for: @@ -319,8 +323,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * to put its dom in another location. * * @method _attachDom + * @throws {Error} + * @suppress {missingReturn} * @param {NodeList} dom to attach to the element. - * @returns {Node} node to which the dom has been attached. + * @return {Node} node to which the dom has been attached. */ _attachDom(dom) { if (this.attachShadow) { @@ -337,6 +343,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN `Polymer.Element can create dom as children instead of in ShadowDOM by setting \`this.root = this;\` before \`ready\`.`); + } } @@ -350,6 +357,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } } + /** + * Update styling for this element + * + * @param {Object=} properties + * Override styling with an object of properties where the keys are css properties, and the values are strings + * Example: `this.updateStyles({'color': 'blue'})` + * These properties are retained unless a value of `null` is set. + */ updateStyles(properties) { if (window.ShadyCSS) { ShadyCSS.applyStyle(this, properties); @@ -378,6 +393,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } + return PolymerElement; }); let hostStack = { diff --git a/src/elements/legacy-element.html b/src/elements/legacy-element.html index cc0b5944..5a8575f0 100644 --- a/src/elements/legacy-element.html +++ b/src/elements/legacy-element.html @@ -89,7 +89,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN detached() {} - attributeChanged() {} + attributeChanged(name, old, value) {} serialize(value) { return this._serializeAttribute(value); @@ -157,8 +157,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * template content. */ instanceTemplate(template) { - var dom = - document.importNode(template._content || template.content, true); + var dom = /** @type {DocumentFragment} */ + (document.importNode(template._content || template.content, true)); return dom; } @@ -167,14 +167,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * Dispatches a custom event with an optional detail value. * * @method fire - * @param {String} type Name of event type. + * @param {string} type Name of event type. * @param {*=} detail Detail value containing event-specific * payload. * @param {Object=} options Object specifying options. These may include: * `bubbles` (boolean, defaults to `true`), * `cancelable` (boolean, defaults to false), and * `node` on which to fire the event (HTMLElement, defaults to `this`). - * @return {CustomEvent} The new event that was fired. + * @return {Event} The new event that was fired. */ fire(type, detail, options) { options = options || {}; @@ -341,7 +341,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * returned by } path Path to set * @param {*} value Value to set - * @param {boolean} fromPath If the value being set was from a path; in + * @param {boolean=} fromPath If the value being set was from a path; in * this case the value was shared, so no dirty check is performed. - * @return {?string} If the root of the path is a managed property, + * @return {string | undefined} If the root of the path is a managed property, * returns a normalized string path suitable for setting into the system * via `_setProperty`/`_setPendingProperty`. A null path is returned if * a path was being set and fails a dirty check, unless `fromPath` @@ -1405,11 +1416,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN path = Polymer.Path.set(this, path, value); // Use property-accessor's simpler dirty check if (!super._shouldPropertyChange(path, value, old)) { - return null; + return undefined; } } if (hasEffect) { return path; + } else { + return undefined; } } @@ -1686,8 +1699,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * are routed to the other. * * @method linkPaths - * @param {string} to Target path to link. - * @param {string} from Source path to link. + * @param {string | Array} to Target path to link. + * @param {string | Array} from Source path to link. * @public */ linkPaths(to, from) { @@ -1708,7 +1721,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * linking the paths. * * @method unlinkPaths - * @param {string} path Target path to unlink. + * @param {string | Array} path Target path to unlink. * @public */ unlinkPaths(path) { @@ -1749,7 +1762,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN */ notifySplices(path, splices) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); notifySplices(this, array, info.path, splices); } @@ -1802,8 +1815,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN if (root) { Polymer.Path.set(root, path, value); } else { - if (!this._hasReadOnlyEffect(path)) { - if ((path = this._setPathOrUnmanagedProperty(path, value))) { + if (!this._hasReadOnlyEffect(/** @type {string} */(path))) { + /** @type {?string | undefined} */ + let propPath; + if ((propPath = this._setPathOrUnmanagedProperty(path, value))) { this._setProperty(path, value); } } @@ -1820,14 +1835,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * splice occurred to the array. * * @method push - * @param {String} path Path to array. - * @param {...any} var_args Items to push onto array + * @param {string} path Path to array. + * @param {...*} items Items to push onto array * @return {number} New length of the array. * @public */ push(path, ...items) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array}*/(Polymer.Path.get(this, path, info)); let len = array.length; let ret = array.push(...items); if (items.length) { @@ -1846,13 +1861,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * splice occurred to the array. * * @method pop - * @param {String} path Path to array. - * @return {any} Item that was removed. + * @param {string} path Path to array. + * @return {*} Item that was removed. * @public */ pop(path) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let hadLength = Boolean(array.length); let ret = array.pop(); if (hadLength) { @@ -1872,16 +1887,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * splice occurred to the array. * * @method splice - * @param {String} path Path to array. + * @param {string} path Path to array. * @param {number} start Index from which to start removing/inserting. * @param {number} deleteCount Number of items to remove. - * @param {...any} var_args Items to insert into array. + * @param {...*} items Items to insert into array. * @return {Array} Array of removed items. * @public */ splice(path, start, deleteCount, ...items) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); // Normalize fancy native splice handling of crazy start values if (start < 0) { start = array.length - Math.floor(-start); @@ -1908,13 +1923,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * splice occurred to the array. * * @method shift - * @param {String} path Path to array. - * @return {any} Item that was removed. + * @param {string} path Path to array. + * @return {*} Item that was removed. * @public */ shift(path) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let hadLength = Boolean(array.length); let ret = array.shift(); if (hadLength) { @@ -1933,14 +1948,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * splice occurred to the array. * * @method unshift - * @param {String} path Path to array. - * @param {...any} var_args Items to insert info array + * @param {string} path Path to array. + * @param {...*} items Items to insert info array * @return {number} New length of the array. * @public */ unshift(path, ...items) { let info = {}; - let array = Polymer.Path.get(this, path, info); + let array = /** @type {Array} */(Polymer.Path.get(this, path, info)); let ret = array.unshift(...items); if (items.length) { notifySplice(this, array, info.path, 0, items.length, []); @@ -1961,16 +1976,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * @public */ notifyPath(path, value) { + /** @type {string} */ + let propPath; if (arguments.length == 1) { // Get value if not supplied let info = {}; value = Polymer.Path.get(this, path, info); - path = info.path; + propPath = info.path; } else if (Array.isArray(path)) { // Normalize path if needed - path = Polymer.Path.normalize(path); + propPath = /** @type {string} */(Polymer.Path.normalize(path)); } - this._setProperty(path, value); + this._setProperty(propPath, value); } /** @@ -2122,6 +2139,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } + return PropertyEffects; }); })(); diff --git a/src/styling/style-gather.html b/src/styling/style-gather.html index 857cf8f9..abbba805 100644 --- a/src/styling/style-gather.html +++ b/src/styling/style-gather.html @@ -22,6 +22,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } return Polymer.DomModule.import(moduleId); }, + /** + * @param {string} moduleIds + * @param {boolean=} warnIfNotFound + * @return {string} + */ cssFromModules(moduleIds, warnIfNotFound) { var modules = moduleIds.trim().split(' '); var cssText = ''; diff --git a/src/template/annotations.html b/src/template/annotations.html index b7965bcc..21f1af3d 100644 --- a/src/template/annotations.html +++ b/src/template/annotations.html @@ -217,7 +217,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN // TODO(sjmiles): is this for non-ELEMENT nodes? If so, we should // change the contract of this method, or filter these out above. if (element.attributes) { - parseNodeAttributeAnnotations(element, note, list); + parseNodeAttributeAnnotations(element, note); // TODO(sorvell): ad hoc callback for doing work on elements while // leveraging annotator's tree walk. // Consider adding an node callback registry and moving specific diff --git a/src/templatizer/dom-repeat.html b/src/templatizer/dom-repeat.html index 7f2c78a8..323dd44d 100644 --- a/src/templatizer/dom-repeat.html +++ b/src/templatizer/dom-repeat.html @@ -112,7 +112,7 @@ Then the `observe` property should be configured as follows: static get template() { return null; } - static get config() { + static get config() { return { @@ -423,6 +423,10 @@ Then the `observe` property should be configured as follows: } } + /** + * @param {Function} fn + * @param {?number=} delay + */ _debounceRender(fn, delay) { this._renderDebouncer = Polymer.Debouncer.debounce(this._renderDebouncer, fn, delay, this); @@ -571,7 +575,7 @@ Then the `observe` property should be configured as follows: var dot = itemsPath.indexOf('.'); var itemsIdx = dot < 0 ? itemsPath : itemsPath.substring(0, dot); // If path was index into array... - if (itemsIdx == parseInt(itemsIdx)) { + if (itemsIdx == parseInt(itemsIdx, 10)) { var itemPath = dot < 0 ? '' : itemsPath.substring(dot+1); // See if the item subpath should trigger a full refresh... if (!this._handleObservedPaths(itemPath)) { @@ -582,7 +586,7 @@ Then the `observe` property should be configured as follows: inst.forwardProperty(this.as + (itemPath ? '.' + itemPath : ''), value); inst.flushProperties(); } - } + } return true; } } @@ -597,7 +601,7 @@ Then the `observe` property should be configured as follows: * * @method itemForElement * @param {HTMLElement} el Element for which to return the item. - * @return {any} Item associated with the element. + * @return {*} Item associated with the element. */ itemForElement(el) { var instance = this.modelForElement(el); @@ -611,7 +615,7 @@ Then the `observe` property should be configured as follows: * * @method indexForElement * @param {HTMLElement} el Element for which to return the index. - * @return {any} Row index associated with the element (note this may + * @return {*} Row index associated with the element (note this may * not correspond to the array index if a user `sort` is applied). */ indexForElement(el) { @@ -634,7 +638,7 @@ Then the `observe` property should be configured as follows: * * @method modelForElement * @param {HTMLElement} el Element for which to return a template model. - * @return {Object} Model representing the binding scope for + * @return {Object} Model representing the binding scope for * the element. */ modelForElement(el) { diff --git a/src/templatizer/templatizer.html b/src/templatizer/templatizer.html index 46b0eb3c..8a48648f 100644 --- a/src/templatizer/templatizer.html +++ b/src/templatizer/templatizer.html @@ -84,6 +84,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN _createTemplatizerClass(template, options) { // Anonymous class created by the templatizer + /** + * @unrestricted + */ var klass = class extends TemplateInstanceBase { //TODO(kschaaf): for debugging; remove? get localName() { return 'template#' + this.__template.id + '/TemplateInstance' } @@ -267,7 +270,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * * @method modelForElement * @param {HTMLElement} el Element for which to return a template model. - * @return {Object} Model representing the binding scope for + * @return {Object} Model representing the binding scope for * the element. */ modelForElement(host, el) { @@ -290,6 +293,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN el = el.parentNode; } } + return null; } } diff --git a/src/utils/case-map.html b/src/utils/case-map.html index ed9e55d9..538d2065 100644 --- a/src/utils/case-map.html +++ b/src/utils/case-map.html @@ -9,8 +9,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN --> diff --git a/src/utils/debounce.html b/src/utils/debounce.html index f1124bf6..9d0b2384 100644 --- a/src/utils/debounce.html +++ b/src/utils/debounce.html @@ -12,55 +12,69 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN diff --git a/src/utils/path.html b/src/utils/path.html index 3544f943..95b209f8 100644 --- a/src/utils/path.html +++ b/src/utils/path.html @@ -11,8 +11,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN diff --git a/src/utils/polymer.dom.html b/src/utils/polymer.dom.html index a09549c1..e21f7261 100644 --- a/src/utils/polymer.dom.html +++ b/src/utils/polymer.dom.html @@ -36,6 +36,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN class EffectiveNodesObserver { constructor(target, callback) { + /** @type {MutationObserver} */ + this.shadyChildrenObserver; + /** @type {MutationObserver} */ + this.nativeChildrenObserver; + this.connected = false; this.target = target; this.callback = callback; this.effectiveNodes = []; diff --git a/src/utils/unresolved.html b/src/utils/unresolved.html index f8d20b6e..db4e2c0e 100644 --- a/src/utils/unresolved.html +++ b/src/utils/unresolved.html @@ -17,12 +17,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } if (window.WebComponents) { - addEventListener('WebComponentsReady', resolve); + window.addEventListener('WebComponentsReady', resolve); } else { if (document.readyState === 'interactive' || document.readyState === 'complete') { resolve(); } else { - addEventListener('DOMContentLoaded', resolve); + window.addEventListener('DOMContentLoaded', resolve); } } diff --git a/src/utils/utils.html b/src/utils/utils.html index 1a160ba0..28e018da 100644 --- a/src/utils/utils.html +++ b/src/utils/utils.html @@ -100,6 +100,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN } }, + /** + * @template T + * @param {T} mixin + * @return {T} + */ dedupingMixin(mixin) { mixin = this.cachingMixin(mixin); return function(base) { @@ -125,16 +130,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN * * @method importHref * @param {string} href URL to document to load. - * @param {Function} onload Callback to notify when an import successfully + * @param {Function=} onload Callback to notify when an import successfully * loaded. - * @param {Function} onerror Callback to notify when an import + * @param {Function=} onerror Callback to notify when an import * unsuccessfully loaded. - * @param {boolean} optAsync True if the import should be loaded `async`. + * @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(href, onload, onerror, optAsync) { - var l = document.createElement('link'); + var l = /** @type {HTMLLinkElement} */(document.createElement('link')); l.rel = 'import'; l.href = href;