Skip to content

Commit

Permalink
Merge pull request #5340 from Polymer/upstream-tweaks
Browse files Browse the repository at this point in the history
Minor changes to formatting, jsdoc, and setting initialization.
  • Loading branch information
kevinpschaaf authored Aug 23, 2018
2 parents c9b539f + 89cc5c6 commit 7791ee9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
15 changes: 14 additions & 1 deletion lib/elements/dom-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,25 @@ import { strictTemplatePolicy } from '../utils/settings.js';

let modules = {};
let lcModules = {};
/**
* Sets a dom-module into the global registry by id.
*
* @param {string} id dom-module id
* @param {DomModule} module dom-module instance
* @return {void}
*/
function setModule(id, module) {
// store id separate from lowercased id so that
// in all cases mixedCase id will stored distinctly
// and lowercase version is a fallback
modules[id] = lcModules[id.toLowerCase()] = module;
}
/**
* Retrieves a dom-module from the global registry by id.
*
* @param {string} id dom-module id
* @return {DomModule!} dom-module instance
*/
function findModule(id) {
return modules[id] || lcModules[id.toLowerCase()];
}
Expand Down Expand Up @@ -133,7 +146,7 @@ export class DomModule extends HTMLElement {
id = id || this.id;
if (id) {
// Under strictTemplatePolicy, reject and null out any re-registered
// dom-module since it is ambiguous whether first-in or last-in is trusted
// dom-module since it is ambiguous whether first-in or last-in is trusted
if (strictTemplatePolicy && findModule(id) !== undefined) {
setModule(id, null);
throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`);
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} prop Property name
* @param {?Object} obj Reference object
* @return {string} Dereferenced value
* @return {string} Potentially renamed property name
*/
window.JSCompiler_renameProperty = function(prop, obj) {
return prop;
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/debounce.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Debouncer {
* called once. Add this method to a custom element:
*
* ```js
* import {microtask} from '@polymer/polymer/lib/utils/async.js';
* import {microTask} from '@polymer/polymer/lib/utils/async.js';
* import {Debouncer} from '@polymer/polymer/lib/utils/debounce.js';
* // ...
*
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const setRootPath = function(path) {
*
* @type {(function(*,string,string,Node):*)|undefined}
*/
export let sanitizeDOMValue = undefined;
export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined;

/**
* Sets the global sanitizeDOMValue available via this module's exported
Expand All @@ -65,7 +65,6 @@ export const setSanitizeDOMValue = function(newSanitizeDOMValue) {
sanitizeDOMValue = newSanitizeDOMValue;
};


/**
* Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures.
* When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/templatize.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class TemplateInstanceBase extends base {
/**
* Override point for adding custom or simulated event handling.
*
* @override
* @param {!Node} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
Expand Down Expand Up @@ -247,6 +248,7 @@ class TemplateInstanceBase extends base {
* textContent bindings while children are "hidden" and cache in
* private storage for later retrieval.
*
* @override
* @param {!Node} node The node to set a property on
* @param {string} prop The property to set
* @param {*} value The value to set
Expand Down

0 comments on commit 7791ee9

Please sign in to comment.