Skip to content

Commit

Permalink
Fix #14 - Allow data as attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Jun 14, 2020
1 parent cbff749 commit 56e99a7
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 12 deletions.
4 changes: 3 additions & 1 deletion cjs/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ const handleAttribute = (node, name/*, svg*/) => {
if (name === 'aria')
return aria(node);

if (name === 'data')
// some SVG node has the data attribute and if it's used as setter it flicks
// see https://github.com/WebReflection/uhtml/issues/14
if (name === 'data' && !(name in node))
return data(node);

if (name.slice(0, 1) === '.')
Expand Down
4 changes: 3 additions & 1 deletion esm/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ const handleAttribute = (node, name/*, svg*/) => {
if (name === 'aria')
return aria(node);

if (name === 'data')
// some SVG node has the data attribute and if it's used as setter it flicks
// see https://github.com/WebReflection/uhtml/issues/14
if (name === 'data' && !(name in node))
return data(node);

if (name.slice(0, 1) === '.')
Expand Down
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ window.uhtml = (function (exports) {
/*, svg*/
) {
if (name === 'ref') return ref(node);
if (name === 'aria') return aria(node);
if (name === 'data') return data(node);
if (name === 'aria') return aria(node); // some SVG node has the data attribute and if it's used as setter it flicks
// see https://github.com/WebReflection/uhtml/issues/14

if (name === 'data' && !(name in node)) return data(node);
if (name.slice(0, 1) === '.') return setter(node, name.slice(1));
if (name.slice(0, 2) === 'on') return event(node, name);
return attribute(node, name
Expand Down
2 changes: 1 addition & 1 deletion min.js

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

Loading

0 comments on commit 56e99a7

Please sign in to comment.