diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-02-26 17:40:39 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-02-26 17:41:34 -0400 |
commit | 84081cc3b5287f925ffeeb94ae730e4c143b5f59 (patch) | |
tree | 41084dae05a8f3e38ab84315e36d6c160decdf09 /src/util | |
parent | f36f93b702729f14021746d56b192b25ac3ed1b7 (diff) |
encode/decode URIs in html.tag('a') & live-dev-server
Fixes #147.
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/html.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/html.js b/src/util/html.js index a6b0d621..459a1647 100644 --- a/src/util/html.js +++ b/src/util/html.js @@ -130,6 +130,14 @@ export function attributes(attribs) { throw new Error(`Attribute value for ${key} should be primitive or array, got ${typeof val}`); }) .filter(([_key, _val, keep]) => keep) + .map(([key, val]) => { + switch (key) { + case 'href': + return [key, encodeURI(val)]; + default: + return [key, val]; + } + }) .map(([key, val]) => typeof val === 'boolean' ? `${key}` |