WebReflection / hyperHTML

A Fast & Light Virtual DOM Alternative
ISC License
3.06k stars 112 forks source link

"negative value" error in SVG #340

Closed jinjor closed 5 years ago

jinjor commented 5 years ago

First of all, thanks for making a nice library!

I'm seeing an error in console when I make multiple elements in <svg>. This is a small example. (Can also be seem at CodePen)

const {bind, wire} = hyperHTML;

const el = document.body;
bind(el)`
  <svg viewBox='0 0 400 400'>
    ${[{}, {}, {}, {}].map((obj, i) => {
      const x = i * 30 + 20;
      const y = 20;
      const r = 3;
      return wire(obj, "svg")`<circle cx=${x} cy=${y} r=${r}></circle>`;
    })}
  </svg>`;
min.js:2 Error: <circle> attribute r: A negative value is not valid. ("-0.331666%")

It looks a comment <!---0.331666%--> generated at the bottom is problematic. A strange fact is that when I omit the last attribute r=${r}, no error message appears.

WebReflection commented 5 years ago

You can ignore that error, cause it's just a useless warning, but everything works as expected, by standards

jinjor commented 5 years ago

Ah okay, thanks!