diff --git a/lib/legacy/class.html b/lib/legacy/class.html index 10cf73b449..d2e0fc1110 100644 --- a/lib/legacy/class.html +++ b/lib/legacy/class.html @@ -42,7 +42,8 @@ */ function mixinBehaviors(behaviors, klass) { if (!behaviors) { - return /** @type {HTMLElement} */(klass); + klass = /** @type {HTMLElement} */(klass); // eslint-disable-line no-self-assign + return klass; } // NOTE: ensure the behavior is extending a class with // legacy element api. This is necessary since behaviors expect to be able diff --git a/lib/legacy/legacy-element-mixin.html b/lib/legacy/legacy-element-mixin.html index faceefe9e7..742bbf9907 100644 --- a/lib/legacy/legacy-element-mixin.html +++ b/lib/legacy/legacy-element-mixin.html @@ -479,7 +479,8 @@ * @return {Array} List of effective child nodes. */ getEffectiveChildNodes() { - return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).getEffectiveChildNodes(); + const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this)); + return domApi.getEffectiveChildNodes(); } /** @@ -491,7 +492,8 @@ * @return {Array} List of distributed elements that match selector. */ queryDistributedElements(selector) { - return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).queryDistributedElements(selector); + const domApi = /** @type {Polymer.DomApi} */(Polymer.dom(this)); + return domApi.queryDistributedElements(selector); } /** @@ -581,9 +583,10 @@ * @suppress {invalidCasts} */ getContentChildren(slctr) { - return /** @type {Array} */(this.getContentChildNodes(slctr).filter(function(n) { + let children = /** @type {Array} */(this.getContentChildNodes(slctr).filter(function(n) { return (n.nodeType === Node.ELEMENT_NODE); })); + return children; } /** diff --git a/lib/legacy/mutable-data-behavior.html b/lib/legacy/mutable-data-behavior.html index 4fb70cb53c..850edf185b 100644 --- a/lib/legacy/mutable-data-behavior.html +++ b/lib/legacy/mutable-data-behavior.html @@ -15,9 +15,8 @@ 'use strict'; let mutablePropertyChange; - ( - /** @suppress {missingProperties} */ - function() { + /** @suppress {missingProperties} */ + (() => { mutablePropertyChange = Polymer.MutableData._mutablePropertyChange; })(); diff --git a/lib/legacy/polymer.dom.html b/lib/legacy/polymer.dom.html index c15820c430..f86596b1e9 100644 --- a/lib/legacy/polymer.dom.html +++ b/lib/legacy/polymer.dom.html @@ -205,7 +205,8 @@ let name = properties[i]; Object.defineProperty(proto, name, { get: function() { - return /** @type {DomApi} */ (this).node[name]; + const domApi = /** @type {DomApi} */(this); + return domApi.node[name]; }, configurable: true }); @@ -217,7 +218,8 @@ let name = properties[i]; Object.defineProperty(proto, name, { get: function() { - return /** @type {DomApi} */ (this).node[name]; + const domApi = /** @type {DomApi} */(this); + return domApi.node[name]; }, set: function(value) { /** @type {DomApi} */ (this).node[name] = value; diff --git a/lib/mixins/property-accessors.html b/lib/mixins/property-accessors.html index 3851a1e426..15900ab7bc 100644 --- a/lib/mixins/property-accessors.html +++ b/lib/mixins/property-accessors.html @@ -605,12 +605,8 @@ * @protected */ _shouldPropertyChange(property, value, old) { - return ( - // Strict equality check - (old !== value && - // This ensures (old==NaN, value==NaN) always returns false - (old === old || value === value)) - ); + // check equality, and ensure (old == NaN, value == NaN) always returns false + return old !== value && (old === old || value === value); } } diff --git a/lib/mixins/template-stamp.html b/lib/mixins/template-stamp.html index f277ff6a6b..aed815c46f 100644 --- a/lib/mixins/template-stamp.html +++ b/lib/mixins/template-stamp.html @@ -429,7 +429,8 @@ applyTemplateContent(this, node, info); applyEventListener(this, node, info); } - return /** @type {!StampedTemplate} */(dom); + dom = /** @type {!StampedTemplate} */(dom); // eslint-disable-line no-self-assign + return dom; } /** diff --git a/lib/utils/flattened-nodes-observer.html b/lib/utils/flattened-nodes-observer.html index 78742e3578..5ea0085a4e 100644 --- a/lib/utils/flattened-nodes-observer.html +++ b/lib/utils/flattened-nodes-observer.html @@ -64,11 +64,13 @@ */ static getFlattenedNodes(node) { if (isSlot(node)) { - return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true}); + node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign + return node.assignedNodes({flatten: true}); } else { - return Array.from(node.childNodes).map(node => { + return Array.from(node.childNodes).map((node) => { if (isSlot(node)) { - return /** @type {HTMLSlotElement} */ (node).assignedNodes({flatten: true}); + node = /** @type {HTMLSlotElement} */(node); // eslint-disable-line no-self-assign + return node.assignedNodes({flatten: true}); } else { return [node]; } diff --git a/lib/utils/gestures.html b/lib/utils/gestures.html index ea2e29c4be..b741455a9d 100644 --- a/lib/utils/gestures.html +++ b/lib/utils/gestures.html @@ -311,7 +311,8 @@ _findOriginalTarget: function(ev) { // shadowdom if (ev.composedPath) { - return /** @type {EventTarget} */(ev.composedPath()[0]); + const target = /** @type {EventTarget} */(ev.composedPath()[0]); + return target; } // shadydom return ev.target; diff --git a/lib/utils/templatize.html b/lib/utils/templatize.html index ef7eead5be..8723f9c9b5 100644 --- a/lib/utils/templatize.html +++ b/lib/utils/templatize.html @@ -466,7 +466,8 @@ klass.prototype.__dataHost = template; klass.prototype.__templatizeOwner = owner; klass.prototype.__hostProps = templateInfo.hostProps; - return /** @type {function(new:TemplateInstanceBase)} */(klass); + klass = /** @type {function(new:TemplateInstanceBase)} */(klass); //eslint-disable-line no-self-assign + return klass; }, /**