From afdd9119ad6f9c9134a23c099433ccadccf0437f Mon Sep 17 00:00:00 2001 From: Peter Burns Date: Fri, 17 Jan 2020 14:07:17 -0800 Subject: [PATCH] Rebase sanitize dom value getter onto legacy-undefined-noBatch (#5618) * 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 | 9 ++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/lib/utils/settings.js b/lib/utils/settings.js index 0d3fcd85d8..f67f55fe97 100644 --- a/lib/utils/settings.js +++ b/lib/utils/settings.js @@ -64,7 +64,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; @@ -73,13 +73,22 @@ export let 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 c19271f680..85e7ad0477 100644 --- a/test/unit/property-effects.html +++ b/test/unit/property-effects.html @@ -26,7 +26,7 @@