From 29428a822eda4d56a0664ab3d5559f85196e1a88 Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Tue, 11 Sep 2018 17:37:18 -0700 Subject: [PATCH] Improve types of flattened-nodes-observer further. --- lib/legacy/polymer.dom.js | 4 ++-- lib/utils/flattened-nodes-observer.js | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/legacy/polymer.dom.js b/lib/legacy/polymer.dom.js index 6574e72884..392e910d36 100644 --- a/lib/legacy/polymer.dom.js +++ b/lib/legacy/polymer.dom.js @@ -54,13 +54,13 @@ export class DomApi { * Returns an instance of `FlattenedNodesObserver` that * listens for node changes on this element. * - * @param {function(this:Element, { target: !Element, addedNodes: !Array, removedNodes: !Array }):void} callback Called when direct or distributed children + * @param {function(this:HTMLElement, { target: !HTMLElement, addedNodes: !Array, removedNodes: !Array }):void} callback Called when direct or distributed children * of this element changes * @return {!FlattenedNodesObserver} Observer instance */ observeNodes(callback) { return new FlattenedNodesObserver( - /** @type {!Element} */(this.node), callback); + /** @type {!HTMLElement} */(this.node), callback); } /** diff --git a/lib/utils/flattened-nodes-observer.js b/lib/utils/flattened-nodes-observer.js index dbbd05d40f..25ff69a1a4 100644 --- a/lib/utils/flattened-nodes-observer.js +++ b/lib/utils/flattened-nodes-observer.js @@ -96,8 +96,8 @@ export class FlattenedNodesObserver { } /** - * @param {!Element} target Node on which to listen for changes. - * @param {?function(this: Element, { target: !Element, addedNodes: !Array, removedNodes: !Array }):void} callback Function called when there are additions + * @param {!HTMLElement} target Node on which to listen for changes. + * @param {?function(this: Element, { target: !HTMLElement, addedNodes: !Array, removedNodes: !Array }):void} callback Function called when there are additions * or removals from the target's list of flattened nodes. */ constructor(target, callback) { @@ -113,7 +113,7 @@ export class FlattenedNodesObserver { this._nativeChildrenObserver = null; this._connected = false; /** - * @type {!Element} + * @type {!HTMLElement} * @private */ this._target = target; @@ -252,8 +252,7 @@ export class FlattenedNodesObserver { addedNodes: [], removedNodes: [] }; - let newNodes = this.constructor.getFlattenedNodes( - /** @type {!HTMLElement} */ (this._target)); + let newNodes = this.constructor.getFlattenedNodes(this._target); let splices = calculateSplices(newNodes, this._effectiveNodes); // process removals