redom / nodom

fake DOM for RE:DOM
ISC License
150 stars 13 forks source link

Duplicated Attributes for created SVG elements #22

Closed MShwed closed 5 years ago

MShwed commented 5 years ago

I've been testing creating SVG and found an issue with attributes being duplicated.

const document = new nodom.Document();

let svg = document.createElement("svg");

svg.setAttribute("width", "100%");
svg.setAttribute("height", "100%");
svg.setAttribute("viewBox", "0 0 500 500");

console.log(svg.outerHTML);

Will result in :

<svg width="100%" height="100%" viewBox="0 0 500 500" width="100%" height="100%" viewBox="0 0 500 500"></svg>
jirutka commented 5 years ago

I can confirm this, nodom really does duplicate attributes.

pakastin commented 5 years ago

Here’s the code if someone wants to take a look: https://github.com/redom/nodom/blob/master/lib/element.js

I’ll get back to this..