Skip to content

Tag classes should be normalized on creation #205

@wch

Description

@wch

Tag classes are way too freeform and this makes it difficult to work with them. For example:

x <- div(class = "a", class = "b c", class = c("d", "e f"))
str(x)
#> List of 3
#>  $ name    : chr "div"
#>  $ attribs :List of 3
#>   ..$ class: chr "a"
#>   ..$ class: chr "b c"
#>   ..$ class: chr [1:2] "d" "e f"
#>  $ children: list()
#>  - attr(*, "class")= chr "shiny.tag"

It would be better if this were translated to a data structure like c("a", "b", "c", "d", "e", "f") or "a b c d e f" when the tag is created.

Edit: I've realized that class isn't special; it makes sense to do this with all HTML attributes. We'll have to be careful about types, though (attributes can be atomic vectors, but they can also be lists or tag objects).

We should also make tagAppendAttribute and friends do the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions