From c44cdc47631d38d433d460f06db1797332ce4f63 Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 9 Dec 2020 09:39:28 -0600 Subject: [PATCH] Follow up to #377. Closes #400. Pass inline arg to widget_html function only if it's defined as a formal argument --- R/htmlwidgets.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/htmlwidgets.R b/R/htmlwidgets.R index 8d9f70dd..8ccc2e16 100644 --- a/R/htmlwidgets.R +++ b/R/htmlwidgets.R @@ -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