Skip to content

Commit 4d730e1

Browse files
committed
Add sanitizeDOMValue to settings.html
Fixes #4753
1 parent ffcd985 commit 4d730e1

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

lib/utils/settings.html

+33-1
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,37 @@
6161
Polymer.setRootPath = function(path) {
6262
Polymer.rootPath = path;
6363
}
64+
65+
/**
66+
* A global callback used to sanitize any value before inserting it into the DOM. The callback signature is:
67+
*
68+
* Polymer = {
69+
* sanitizeDOMValue: function(value, name, type, node) { ... }
70+
* }
71+
*
72+
* Where:
73+
*
74+
* `value` is the value to sanitize.
75+
* `name` is the name of an attribute or property (for example, href).
76+
* `type` indicates where the value is being inserted: one of property, attribute, or text.
77+
* `node` is the node where the value is being inserted.
78+
*
79+
* @type {(function(*,string,string,Node):*)|undefined}
80+
* @memberof Polymer
81+
*/
82+
let sanitizeDOMValue = Polymer.sanitizeDOMValue;
83+
84+
// This is needed for tooling
85+
Polymer.sanitizeDOMValue = sanitizeDOMValue;
86+
87+
/**
88+
* Sets the global sanitizeDOMValue available via `Polymer.sanitizeDOMValue`.
89+
*
90+
* @memberof Polymer
91+
* @param {(function(*,string,string,Node):*)|undefined} sanitizeDOMValue the global sanitizeDOMValue callback
92+
*/
93+
Polymer.setSanitizeDOMValue = function(sanitizeDOMValue) {
94+
Polymer.sanitizeDOMValue = sanitizeDOMValue;
95+
}
6496
})();
65-
</script>
97+
</script>

0 commit comments

Comments
 (0)