We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents d1a9ddd + 9f09ba1 commit 1da1bdbCopy full SHA for 1da1bdb
src/util.js
@@ -1,8 +1,14 @@
1
// DOM properties that should NOT have "px" added when numeric
2
export const IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;
3
4
-export function encodeEntities(s) {
5
- return String(s)
+const ENCODED_ENTITIES = /[&<>"]/;
+
6
+export function encodeEntities(input) {
7
+ const s = String(input);
8
+ if (!ENCODED_ENTITIES.test(s)) {
9
+ return s;
10
+ }
11
+ return s
12
.replace(/&/g, '&')
13
.replace(/</g, '<')
14
.replace(/>/g, '>')
0 commit comments