Skip to content

Commit

Permalink
Follow up to #377. Closes #400. Pass inline arg to widget_html functi…
Browse files Browse the repository at this point in the history
…on only if it's defined as a formal argument
  • Loading branch information
cpsievert committed Dec 9, 2020
1 parent c73346f commit c44cdc4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion R/htmlwidgets.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,14 @@ widget_html <- function (name, package, id, style, class, inline = FALSE, ...) {
fn_info <- lookup_widget_html_method(name, package)

fn <- fn_info[["fn"]]
fn_res <- fn(id = id, style = style, class = class, inline = inline, ...)
# id, style, and class have been required args for years, but inline is fairly new
# and undocumented, so unsuprisingly there are widgets out there are don't have an
# inline arg https://github.com/renkun-ken/formattable/blob/484777/R/render.R#L79-L88
args <- list(id = id, style = style, class = class, ...)
if ("inline" %in% names(formals(fn))) {
args$inline <- inline
}
fn_res <- do.call(fn, args)
if (isTRUE(fn_info[["legacy"]])) {
# For the PACKAGE:::NAME_html form (only), we worry about false positives;
# hopefully false positives will return something that doesn't look like a
Expand Down

0 comments on commit c44cdc4

Please sign in to comment.