Skip to content

Boolean attributes in script tag not rendered correctly #197

@cpsievert

Description

@cpsievert

In #188, we added the ability to specify <script> attributes with a list of values. However, it doesn't seem to support boolean attribites in the same way as other tags (i.e., div(foo=NA) gets rendered as <div foo></div>).

For example:

library(htmltools)
dep <- htmlDependency(
  "foo", "1.0",
  src = list(href = "foo/"),
  script = list(src = "my.js", defer = NA)
)
renderDependencies(list(dep))
#> <script src="foo/my.js" defer="NA"></script>

BTW, the above seems to work in Chrome/Firefox, but it really should be rendered as

#> <script src="foo/my.js" defer></script>

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