web-manager 3.2.60 → 3.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utilities.js +23 -2
- package/package.json +1 -1
package/lib/utilities.js
CHANGED
@@ -110,11 +110,17 @@ Utilities.escapeHTML = function (str) {
|
|
110
110
|
shadow.innerHTML = '';
|
111
111
|
shadow.appendChild(document.createTextNode(str));
|
112
112
|
|
113
|
-
return shadow.innerHTML.replace(/["']/g, function(m) {
|
113
|
+
return shadow.innerHTML.replace(/[&<>"']/g, function(m) {
|
114
114
|
switch (m) {
|
115
|
+
case '&':
|
116
|
+
return '&';
|
117
|
+
case '<':
|
118
|
+
return '<';
|
119
|
+
case '>':
|
120
|
+
return '>';
|
115
121
|
case '"':
|
116
122
|
return '"';
|
117
|
-
|
123
|
+
case "'":
|
118
124
|
return ''';
|
119
125
|
}
|
120
126
|
});
|
@@ -144,4 +150,19 @@ Utilities.getContext = function () {
|
|
144
150
|
}
|
145
151
|
}
|
146
152
|
|
153
|
+
// Navigate fn that takes a url and an object of query params
|
154
|
+
Utilities.navigate = function (url, params) {
|
155
|
+
// Should work if the url is a relative path too
|
156
|
+
var newUrl = new URL(url, window.location.origin);
|
157
|
+
|
158
|
+
// Add the params to the url
|
159
|
+
Object.keys(params).forEach(function (key) {
|
160
|
+
newUrl.searchParams.set(key, params[key]);
|
161
|
+
});
|
162
|
+
|
163
|
+
// Navigate to the new url
|
164
|
+
window.location.href = newUrl;
|
165
|
+
}
|
166
|
+
|
167
|
+
|
147
168
|
module.exports = Utilities;
|
package/package.json
CHANGED