rstudio / htmltools

Tools for HTML generation and output
https://rstudio.github.io/htmltools/
214 stars 67 forks source link

Duplicate attribute names change order when written to HTML #349

Open cpsievert opened 1 year ago

cpsievert commented 1 year ago

For example

> div(id = "foo", class = "bar", class = "baz")
<div class="bar baz" id="foo"></div>
> tagAppendAttributes(div(id = "foo", class = "bar"), class = "baz")
<div class="bar baz" id="foo"></div>

This is a result of

https://github.com/rstudio/htmltools/blob/c237804eebcd1ead835cd62bcf1f26267fb03574/R/tags.R#L1362

(and maybe we just remove the sort()?)

cpsievert commented 1 year ago

FWIW, this behavior appears to go back to at least v0.4.0

wch commented 1 year ago

Looks like the sorting was added in #282.