From aec4cb681eb825af90cdbae9f4c4b0c32cb77f8a Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Fri, 17 Jan 2020 14:06:33 -0800 Subject: [PATCH] Add getSanitizeDOMValue to settings API (#5617) * Add getSanitizeDOMValue to settings API For environments that don't well support `export let`. * Add a test for getSanitizeDOMValue --- lib/utils/settings.js | 13 +++++++++++-- test/unit/property-effects.html | 11 +++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/utils/settings.js b/lib/utils/settings.js index 017278ddc5..519ea68313 100644 --- a/lib/utils/settings.js +++ b/lib/utils/settings.js @@ -49,7 +49,7 @@ export const setRootPath = function(path) { * `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} + * @type {(function(*,string,string,?Node):*)|undefined} */ export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined; @@ -57,13 +57,22 @@ export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue * Sets the global sanitizeDOMValue available via this module's exported * `sanitizeDOMValue` variable. * - * @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback + * @param {(function(*,string,string,?Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback * @return {void} */ export const setSanitizeDOMValue = function(newSanitizeDOMValue) { sanitizeDOMValue = newSanitizeDOMValue; }; +/** + * Gets sanitizeDOMValue, for environments that don't well support `export let`. + * + * @return {(function(*,string,string,?Node):*)|undefined} sanitizeDOMValue + */ +export const getSanitizeDOMValue = function() { + return sanitizeDOMValue; +}; + /** * 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 diff --git a/test/unit/property-effects.html b/test/unit/property-effects.html index 087023914f..9e2639c932 100644 --- a/test/unit/property-effects.html +++ b/test/unit/property-effects.html @@ -26,7 +26,7 @@