From 82fd7ade12d9bac644724b4eefcca1f63e1b008b Mon Sep 17 00:00:00 2001 From: jdlrobson Date: Tue, 1 Jan 2019 13:47:49 -0800 Subject: [PATCH] Fix compatibility with jQuery repeat add forms In 2f58b99 we removed a duplicate htmlquote function but took away a crucial line that is being used by template.js After trying to resolve the issue inside template (which uses eval!!) without any luck I decided to document the function signature to make it clear why this is needed. Fixes: #1796 Fixes: #1795 --- openlibrary/plugins/openlibrary/js/jsdef.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openlibrary/plugins/openlibrary/js/jsdef.js b/openlibrary/plugins/openlibrary/js/jsdef.js index 5711e21618a..8709a94f147 100644 --- a/openlibrary/plugins/openlibrary/js/jsdef.js +++ b/openlibrary/plugins/openlibrary/js/jsdef.js @@ -135,7 +135,13 @@ function websafe(value) { /* eslint-disable no-unused-vars */ // used in websafe function +/** + * Quote a string + * @param {string|number} text to quote + */ function htmlquote(text) { + // This code exists for compatibility with template.js + text = String(text); text = text.replace("&", "&"); // Must be done first! text = text.replace("<", "<"); text = text.replace(">", ">");