Skip to content

Commit ad0f05c

Browse files
committed
Fix #87 - Do not use smart handlers for SVG attributes
1 parent 02f8feb commit ad0f05c

7 files changed

Lines changed: 28 additions & 27 deletions

File tree

esm/handler.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,19 @@ export const attr = new Map([
153153
/**
154154
* @param {Element} element
155155
* @param {string} name
156+
* @param {boolean} svg
156157
* @returns
157158
*/
158-
export const attribute = (element, name) => {
159+
export const attribute = (element, name, svg) => {
159160
switch (name[0]) {
160161
case '.': return dot;
161162
case '?': return toggle;
162163
case '@': return at;
163-
default: return attr.get(name) || (name in element ? direct : regular);
164+
default: return (
165+
svg ?
166+
regular :
167+
(attr.get(name) || (name in element ? direct : regular))
168+
);
164169
}
165170
};
166171

esm/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const resolve = (template, values, xml) => {
6464
while (node.hasAttribute(search)) {
6565
if (!path) path = createPath(node);
6666
const name = node.getAttribute(search);
67-
entries.push(entry(ATTRIBUTE_NODE, path, attribute(node, name), name));
67+
entries.push(entry(ATTRIBUTE_NODE, path, attribute(node, name, xml), name));
6868
node.removeAttribute(search);
6969
search = `${prefix}${i++}`;
7070
}

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)