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

Add sanitizeDOMValue to settings.html #4754

Merged
merged 1 commit into from
Jul 31, 2017
Merged
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
34 changes: 33 additions & 1 deletion lib/utils/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,37 @@
Polymer.setRootPath = function(path) {
Polymer.rootPath = path;
}

/**
* A global callback used to sanitize any value before inserting it into the DOM. The callback signature is:
*
* Polymer = {
* sanitizeDOMValue: function(value, name, type, node) { ... }
* }
*
* Where:
*
* `value` is the value to sanitize.
* `name` is the name of an attribute or property (for example, href).
* `type` indicates where the value is being inserted: one of property, attribute, or text.
* `node` is the node where the value is being inserted.
*
* @type {(function(*,string,string,Node):*)|undefined}
* @memberof Polymer
*/
let sanitizeDOMValue = Polymer.sanitizeDOMValue;

// This is needed for tooling
Polymer.sanitizeDOMValue = sanitizeDOMValue;

/**
* Sets the global sanitizeDOMValue available via `Polymer.sanitizeDOMValue`.
*
* @memberof Polymer
* @param {(function(*,string,string,Node):*)|undefined} sanitizeDOMValue the global sanitizeDOMValue callback
*/
Polymer.setSanitizeDOMValue = function(sanitizeDOMValue) {
Polymer.sanitizeDOMValue = sanitizeDOMValue;
}
})();
</script>
</script>