mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Fix some closure warnings.
This commit is contained in:
@@ -529,7 +529,7 @@ Polymer_LegacyElementMixin.prototype.instanceTemplate = function(template){};
|
||||
/**
|
||||
* @param {string} type
|
||||
* @param {*=} detail
|
||||
* @param {Object=} options
|
||||
* @param {fireOptions=} options
|
||||
* @return {Event}
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.fire = function(type, detail, options){};
|
||||
@@ -547,7 +547,7 @@ Polymer_LegacyElementMixin.prototype.listen = function(node, eventName, methodNa
|
||||
Polymer_LegacyElementMixin.prototype.unlisten = function(node, eventName, methodName){};
|
||||
/**
|
||||
* @param {string=} direction
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.setScrollDirection = function(direction, node){};
|
||||
/**
|
||||
@@ -601,7 +601,7 @@ Polymer_LegacyElementMixin.prototype.getContentChildren = function(slctr){};
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.isLightDescendant = function(node){};
|
||||
/**
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
* @return {boolean}
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.isLocalDescendant = function(node){};
|
||||
@@ -668,25 +668,25 @@ Polymer_LegacyElementMixin.prototype.elementMatches = function(selector, node){}
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {boolean=} bool
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.toggleAttribute = function(name, bool, node){};
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {boolean=} bool
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.toggleClass = function(name, bool, node){};
|
||||
/**
|
||||
* @param {string} transformText
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.transform = function(transformText, node){};
|
||||
/**
|
||||
* @param {number} x
|
||||
* @param {number} y
|
||||
* @param {number} z
|
||||
* @param {HTMLElement=} node
|
||||
* @param {Element=} node
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype.translate3d = function(x, y, z, node){};
|
||||
/**
|
||||
@@ -713,10 +713,11 @@ Polymer_LegacyElementMixin.prototype._warn = function(args){};
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype._error = function(args){};
|
||||
/**
|
||||
* @param {string} methodName
|
||||
* @param {*} args
|
||||
* @return {string}
|
||||
* @return {Array}
|
||||
*/
|
||||
Polymer_LegacyElementMixin.prototype._logf = function(args){};
|
||||
Polymer_LegacyElementMixin.prototype._logf = function(methodName, args){};
|
||||
/**
|
||||
* @record
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @memberof Polymer
|
||||
* @summary Element class mixin that provides Polymer's "legacy" API
|
||||
*/
|
||||
Polymer.LegacyElementMixin = Polymer.dedupingMixin(base => {
|
||||
Polymer.LegacyElementMixin = Polymer.dedupingMixin((base) => {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -59,6 +59,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
'all': 'auto'
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* bubbles: (boolean|undefined),
|
||||
* cancelable: (boolean|undefined),
|
||||
* composed: (boolean|undefined)
|
||||
* }}
|
||||
*/
|
||||
let fireOptions; // eslint-disable-line no-unused-vars
|
||||
|
||||
/**
|
||||
* @polymerMixinClass
|
||||
* @implements {Polymer_LegacyElementMixin}
|
||||
@@ -257,7 +266,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {Element} node Element to set attribute to.
|
||||
*/
|
||||
serializeValueToAttribute(value, attribute, node) {
|
||||
this._valueToNodeAttribute(node || this, value, attribute);
|
||||
this._valueToNodeAttribute(/** @type {Element} */ (node || this), value, attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,13 +346,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
/* **** Begin Events **** */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Dispatches a custom event with an optional detail value.
|
||||
*
|
||||
* @param {string} type Name of event type.
|
||||
* @param {*=} detail Detail value containing event-specific
|
||||
* payload.
|
||||
* @param {Object=} options Object specifying options. These may include:
|
||||
* @param {fireOptions=} 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`).
|
||||
@@ -372,7 +383,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {string} methodName Name of handler method on `this` to call.
|
||||
*/
|
||||
listen(node, eventName, methodName) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
let hbl = this.__boundListeners ||
|
||||
(this.__boundListeners = new WeakMap());
|
||||
let bl = hbl.get(node);
|
||||
@@ -397,7 +408,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
anymore.
|
||||
*/
|
||||
unlisten(node, eventName, methodName) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
let bl = this.__boundListeners && this.__boundListeners.get(node);
|
||||
let key = eventName + methodName;
|
||||
let handler = bl && bl[key];
|
||||
@@ -418,11 +429,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*
|
||||
* @param {string=} direction Direction to allow scrolling
|
||||
* Defaults to `all`.
|
||||
* @param {HTMLElement=} node Element to apply scroll direction setting.
|
||||
* @param {Element=} node Element to apply scroll direction setting.
|
||||
* Defaults to `this`.
|
||||
*/
|
||||
setScrollDirection(direction, node) {
|
||||
Polymer.Gestures.setTouchAction(node || this, DIRECTION_MAP[direction] || 'auto');
|
||||
Polymer.Gestures.setTouchAction(/** @type {Element} */ (node || this), DIRECTION_MAP[direction] || 'auto');
|
||||
}
|
||||
/* **** End Events **** */
|
||||
|
||||
@@ -442,6 +453,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* Return the element whose local dom within which this element
|
||||
* is contained. This is a shorthand for
|
||||
* `this.getRootNode().host`.
|
||||
* @this {Element}
|
||||
*/
|
||||
get domHost() {
|
||||
let root = this.getRootNode();
|
||||
@@ -467,11 +479,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* childNodes list is the same as the element's childNodes except that
|
||||
* any `<content>` elements are replaced with the list of nodes distributed
|
||||
* to the `<content>`, the result of its `getDistributedNodes` method.
|
||||
*
|
||||
* @this {Element}
|
||||
* @return {Array<Node>} List of effctive child nodes.
|
||||
*/
|
||||
getEffectiveChildNodes() {
|
||||
return Polymer.dom(this).getEffectiveChildNodes();
|
||||
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).getEffectiveChildNodes();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,10 +491,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* `selector`. These can be dom children or elements distributed to
|
||||
* children that are insertion points.
|
||||
* @param {string} selector Selector to run.
|
||||
* @this {Element}
|
||||
* @return {Array<Node>} List of distributed elements that match selector.
|
||||
*/
|
||||
queryDistributedElements(selector) {
|
||||
return Polymer.dom(this).queryDistributedElements(selector);
|
||||
return /** @type {Polymer.DomApi} */ (Polymer.dom(this)).queryDistributedElements(selector);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -495,7 +508,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*/
|
||||
getEffectiveChildren() {
|
||||
let list = this.getEffectiveChildNodes();
|
||||
return list.filter(function(n) {
|
||||
return list.filter(function(/** @type {Node} */ n) {
|
||||
return (n.nodeType === Node.ELEMENT_NODE);
|
||||
});
|
||||
}
|
||||
@@ -553,7 +566,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*/
|
||||
getContentChildNodes(slctr) {
|
||||
let content = this.root.querySelector(slctr || 'slot');
|
||||
return content ? Polymer.dom(content).getDistributedNodes() : [];
|
||||
return content ? /** @type {Polymer.DomApi} */(Polymer.dom(content)).getDistributedNodes() : [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -580,6 +593,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* Checks whether an element is in this element's light DOM tree.
|
||||
*
|
||||
* @param {?Node} node The element to be checked.
|
||||
* @this {Element}
|
||||
* @return {boolean} true if node is in this element's light DOM tree.
|
||||
*/
|
||||
isLightDescendant(node) {
|
||||
@@ -590,7 +604,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
/**
|
||||
* Checks whether an element is in this element's local DOM tree.
|
||||
*
|
||||
* @param {HTMLElement=} node The element to be checked.
|
||||
* @param {Element=} node The element to be checked.
|
||||
* @return {boolean} true if node is in this element's local DOM tree.
|
||||
*/
|
||||
isLocalDescendant(node) {
|
||||
@@ -767,7 +781,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @return {boolean} Whether the element matches the selector.
|
||||
*/
|
||||
elementMatches(selector, node) {
|
||||
return Polymer.dom.matchesSelector(node || this, selector);
|
||||
return Polymer.dom.matchesSelector(/** @type {!Element} */ (node || this), selector);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -776,10 +790,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {string} name HTML attribute name
|
||||
* @param {boolean=} bool Boolean to force the attribute on or off.
|
||||
* When unspecified, the state of the attribute will be reversed.
|
||||
* @param {HTMLElement=} node Node to target. Defaults to `this`.
|
||||
* @param {Element=} node Node to target. Defaults to `this`.
|
||||
*/
|
||||
toggleAttribute(name, bool, node) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
if (arguments.length == 1) {
|
||||
bool = !node.hasAttribute(name);
|
||||
}
|
||||
@@ -797,10 +811,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {string} name CSS class name
|
||||
* @param {boolean=} bool Boolean to force the class on or off.
|
||||
* When unspecified, the state of the class will be reversed.
|
||||
* @param {HTMLElement=} node Node to target. Defaults to `this`.
|
||||
* @param {Element=} node Node to target. Defaults to `this`.
|
||||
*/
|
||||
toggleClass(name, bool, node) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
if (arguments.length == 1) {
|
||||
bool = !node.classList.contains(name);
|
||||
}
|
||||
@@ -815,11 +829,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* Cross-platform helper for setting an element's CSS `transform` property.
|
||||
*
|
||||
* @param {string} transformText Transform setting.
|
||||
* @param {HTMLElement=} node Element to apply the transform to.
|
||||
* @param {Element=} node Element to apply the transform to.
|
||||
* Defaults to `this`
|
||||
*/
|
||||
transform(transformText, node) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
node.style.webkitTransform = transformText;
|
||||
node.style.transform = transformText;
|
||||
}
|
||||
@@ -831,11 +845,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* @param {number} x X offset.
|
||||
* @param {number} y Y offset.
|
||||
* @param {number} z Z offset.
|
||||
* @param {HTMLElement=} node Element to apply the transform to.
|
||||
* @param {Element=} node Element to apply the transform to.
|
||||
* Defaults to `this`.
|
||||
*/
|
||||
translate3d(x, y, z, node) {
|
||||
node = node || this;
|
||||
node = /** @type {Element} */ (node || this);
|
||||
this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
|
||||
}
|
||||
|
||||
@@ -895,7 +909,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
/**
|
||||
* Facades `console.log` as an override point.
|
||||
*
|
||||
* @param {...*} var_args Array of strings or objects to log
|
||||
* @param {...*} args Array of strings or objects to log
|
||||
*/
|
||||
_log(...args) {
|
||||
this._logger('log', args);
|
||||
@@ -904,7 +918,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
/**
|
||||
* Facades `console.warn` as an override point.
|
||||
*
|
||||
* @param {...*} var_args Array of strings or objects to log
|
||||
* @param {...*} args Array of strings or objects to log
|
||||
*/
|
||||
_warn(...args) {
|
||||
this._logger('warn', args);
|
||||
@@ -913,7 +927,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
/**
|
||||
* Facades `console.error` as an override point.
|
||||
*
|
||||
* @param {...*} var_args Array of strings or objects to log
|
||||
* @param {...*} args Array of strings or objects to log
|
||||
*/
|
||||
_error(...args) {
|
||||
this._logger('error', args)
|
||||
@@ -923,16 +937,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
* Formats a message using the element type an a method name.
|
||||
*
|
||||
* @param {string} methodName Method name to associate with message
|
||||
* @param {...*} var_args Array of strings or objects to log
|
||||
* @return {string} String with formatting information for `console`
|
||||
* @param {...*} args Array of strings or objects to log
|
||||
* @return {Array} Array with formatting information for `console`
|
||||
* logging.
|
||||
*/
|
||||
_logf(...args) {
|
||||
return ['[%s::%s]', this.is, ...args];
|
||||
_logf(methodName, ...args) {
|
||||
return ['[%s::%s]', this.is, methodName, ...args];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LegacyElement.prototype.is = '';
|
||||
|
||||
return LegacyElement;
|
||||
|
||||
});
|
||||
|
||||
@@ -287,6 +287,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
}
|
||||
}
|
||||
|
||||
Polymer.DomApi = DomApi;
|
||||
|
||||
/**
|
||||
* Legacy DOM and Event manipulation API wrapper factory used to abstract
|
||||
* differences between native Shadow DOM and "Shady DOM" when polyfilling on
|
||||
|
||||
@@ -173,7 +173,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*
|
||||
* @memberof Polymer.Async.timeOut
|
||||
* @param {Function} callback Callback to run
|
||||
* @return {*} Handle used for canceling task
|
||||
* @return {number} Handle used for canceling task
|
||||
*/
|
||||
run(callback) {
|
||||
microtaskNode.textContent = microtaskNodeContent++;
|
||||
|
||||
Reference in New Issue
Block a user