From 4d730e16a8bcef6e40ce2f26de302e1df71ea4f3 Mon Sep 17 00:00:00 2001 From: Justin Fagnani Date: Tue, 25 Jul 2017 15:13:09 -0700 Subject: [PATCH] Add sanitizeDOMValue to settings.html Fixes #4753 --- lib/utils/settings.html | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/utils/settings.html b/lib/utils/settings.html index 6e30f166e3..1275c1ce6c 100644 --- a/lib/utils/settings.html +++ b/lib/utils/settings.html @@ -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; + } })(); - \ No newline at end of file +