4 ms·
I think you're looking at the DOM, not the Source. Javascript adds CSS to the style attribute.
by tomelders 14y ago
I think you're looking at the DOM, not the Source. Javascript adds CSS to the style attribute.
- silveira 14y agoYes, I was looking at the DOM. But why add styles as attributes? There is any performance improvement? Couldn't be done with just CSS?
- TazeTSchnitzel 14y agoWell that is CSS. And of course there's a performance improvement - unless you're applying a transformation to a hundred or so elements, it's usually much quicker to directly manipulate element.style than generate some CSS, put it in a style element, append that to the DOM, and wait for the browser to parse the CSS.