Debian Codegraph @

R/utils-tags.R

raw
1 # Check if `x` is a tag(), tagList(), or HTML()
2 # @param strict If `FALSE`, also consider a normal list() of 'tags' to be a tag list.
3 isTagLike <- function(x, strict = FALSE) {
4 isTag(x) || isTagList(x, strict = strict) || isTRUE(attr(x, "html"))
5 }
6
7 isTag <- function(x) {
8 inherits(x, "shiny.tag")
9 }
10
11 isTagList <- function(x, strict = TRUE) {
12 if (strict) {
13 return(inherits(x, "shiny.tag.list"))
14 }
15
16 if (!is.list(x)) {
17 return(FALSE)
18 }
19
20 all(vapply(x, isTagLike, logical(1)))
21 }