ractivejs / ractive

Next-generation DOM manipulation
http://ractive.js.org
MIT License
5.94k stars 396 forks source link

Ractive inserts double semicolon in the last inline style #3257

Closed kouts closed 6 years ago

kouts commented 6 years ago

Description:

Ractive inserts double semicolon in the last inline style rule.

Versions affected:

0.10.5

Platforms affected:

All browsers

Reproduction:

Playground link

evs-chris commented 6 years ago

So, not exactly a bug, but a slightly weird behavior that was added with merging multiple style attributes together to allow them to be static. As of 0.10, you can have <div style="color: green; background: red;" style-font-size="1em" style="border: 1px solid;"></div> and the parser will merge all of those into a single node that ractive knows won't change, so it can short circuit any tracking logic and save a bit of time on renders and updates. When I added that, I didn't add a check to see if the style ended in a semicolon and just added one every time, since it didn't affect the outcome.

It does look a bit weird though, so I've added the check to only add one when necessary to edge. Thanks!