concatenate duplicate attributes in tag definitions

This commit is contained in:
JJ Allaire
2013-12-12 08:41:53 -05:00
parent d907992c39
commit 3fc14102e5
2 changed files with 4 additions and 5 deletions

2
NEWS
View File

@@ -42,7 +42,7 @@ column functions for creating arbitrary bootstrap grid layouts.
* Added `hr()` builder function for creating horizontal rules.
* Automatically concatenate multiple class attributes in tag definitions
* Automatically concatenate duplicate attributes in tag definitions
shiny 0.8.0

View File

@@ -149,11 +149,10 @@ tagWrite <- function(tag, textWriter, indent=0, context = NULL, eol = "\n") {
# write tag name
textWriter(paste(indentText, "<", tag$name, sep=""))
# concatenate class attributes
# concatenate attributes
attribs <- tag$attribs
classValue <- paste(attribs[names(attribs) == "class"], collapse=" ")
attribs <- c(list(class = classValue), attribs[names(attribs) != "class"])
attribs <- lapply(split(attribs, names(attribs)), paste, collapse = " ")
# write attributes
for (attrib in names(attribs)) {
attribValue <- attribs[[attrib]]