Skip to content

Commit

Permalink
Fix #87 - Do not use smart handlers for SVG attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Nov 13, 2023
1 parent 02f8feb commit ad0f05c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 27 deletions.
9 changes: 7 additions & 2 deletions esm/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,19 @@ export const attr = new Map([
/**
* @param {Element} element
* @param {string} name
* @param {boolean} svg
* @returns
*/
export const attribute = (element, name) => {
export const attribute = (element, name, svg) => {
switch (name[0]) {
case '.': return dot;
case '?': return toggle;
case '@': return at;
default: return attr.get(name) || (name in element ? direct : regular);
default: return (
svg ?
regular :
(attr.get(name) || (name in element ? direct : regular))
);
}
};

Expand Down
2 changes: 1 addition & 1 deletion esm/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const resolve = (template, values, xml) => {
while (node.hasAttribute(search)) {
if (!path) path = createPath(node);
const name = node.getAttribute(search);
entries.push(entry(ATTRIBUTE_NODE, path, attribute(node, name), name));
entries.push(entry(ATTRIBUTE_NODE, path, attribute(node, name, xml), name));
node.removeAttribute(search);
search = `${prefix}${i++}`;
}
Expand Down
2 changes: 1 addition & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ad0f05c

Please sign in to comment.