Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various Polymer Closure compilation fixes #5558

Merged
merged 1 commit into from
Jun 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elements/dom-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class DomRepeat extends domRepeatBase {
this.__sortFn = null;
this.__filterFn = null;
this.__observePaths = null;
/** @type {?function(new:TemplateInstanceBase, *)} */
/** @type {?function(new:TemplateInstanceBase, Object=)} */
this.__ctor = null;
this.__isDetached = true;
this.template = null;
Expand Down
1 change: 0 additions & 1 deletion lib/legacy/mutable-data-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export const OptionalMutableDataBehavior = {
* @param {*} value New property value
* @param {*} old Previous property value
* @return {boolean} Whether the property should be considered a change
* @this {this}
* @protected
*/
_shouldPropertyChange(property, value, old) {
Expand Down
17 changes: 9 additions & 8 deletions lib/legacy/templatizer-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { TemplateInstanceBase, templatize, modelForElement } from '../utils/temp
* _instanceProps: Object,
* _forwardHostPropV2: Function,
* _notifyInstancePropV2: Function,
* ctor: TemplateInstanceBase
* ctor: function(new:TemplateInstanceBase, Object=)
* }}
*/
let TemplatizerUser; // eslint-disable-line
Expand Down Expand Up @@ -99,13 +99,14 @@ export const Templatizer = {
*/
templatize(template, mutableData) {
this._templatizerTemplate = template;
this.ctor = templatize(template, this, {
mutableData: Boolean(mutableData),
parentModel: this._parentModel,
instanceProps: this._instanceProps,
forwardHostProp: this._forwardHostPropV2,
notifyInstanceProp: this._notifyInstancePropV2
});
this.ctor =
templatize(template, /** @type {!Polymer_PropertyEffects} */ (this), {
mutableData: Boolean(mutableData),
parentModel: this._parentModel,
instanceProps: this._instanceProps,
forwardHostProp: this._forwardHostPropV2,
notifyInstanceProp: this._notifyInstancePropV2
});
},

/**
Expand Down
9 changes: 6 additions & 3 deletions lib/utils/templatize.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function upgradeTemplate(template, constructor) {
/**
* Base class for TemplateInstance.
* @constructor
* @extends {HTMLElement}
* @implements {Polymer_PropertyEffects}
* @private
*/
Expand All @@ -119,7 +120,9 @@ class TemplateInstanceBase extends templateInstanceBase {
/** @type {!StampedTemplate} */
this.root = this._stampTemplate(this.__dataHost);
// Save list of stamped children
let children = this.children = [];
let children = [];
/** @suppress {invalidCasts} */
this.children = /** @type {!NodeList} */ (children);
// Polymer 1.x did not use `Polymer.dom` here so not bothering.
for (let n = this.root.firstChild; n; n=n.nextSibling) {
children.push(n);
Expand Down Expand Up @@ -532,8 +535,8 @@ function createNotifyHostPropEffect() {
* @param {Polymer_PropertyEffects=} owner Owner of the template instances;
* any optional callbacks will be bound to this owner.
* @param {Object=} options Options dictionary (see summary for details)
* @return {function(new:TemplateInstanceBase)} Generated class bound to the template
* provided
* @return {function(new:TemplateInstanceBase, Object=)} Generated class bound
* to the template provided
* @suppress {invalidCasts}
*/
export function templatize(template, owner, options) {
Expand Down