HTML element builder

HTML element builder

Details

It is up to the user to escape text if necessary. See esc() and attesc() functions to help with this, although if you are working within shiny, then this should happen automatically.

Named arguments are considered attributes and will overwrite existing attributes with the same name. Set to NULL to delete the attribute. Set to NA to make this a bare attribute without a value.

Unnamed arguments are appended to the list of child nodes. These should be text, other HTMLElements or any ojbect that can be represented as a single text string using "as.character()". To be specific about where in the child list a node will be placed, use $append()

Public fields

name

name of node e.g. "div"

attribs

named list of attributes of this node

children

list of immediate children of this node

Methods

Public methods


Method a()

Usage

HTMLElement$a(..., href, hreflang, media, rel, target, type)


Method abbr()

Usage

HTMLElement$abbr(...)


Method address()

Usage

HTMLElement$address(...)


Method area()

Usage

HTMLElement$area(
  ...,
  alt,
  coords,
  href,
  hreflang,
  media,
  rel,
  shape,
  target,
  type
)


Method article()

Usage

HTMLElement$article(...)


Method aside()

Usage

HTMLElement$aside(...)


Method audio()

Usage

HTMLElement$audio(
  ...,
  autoplay,
  controls,
  loop,
  mediagroup,
  muted,
  preload,
  src
)


Method b()

Usage

HTMLElement$b(...)


Method base()

Usage

HTMLElement$base(..., href, target)


Method bdi()

Usage

HTMLElement$bdi(...)


Method bdo()

Usage

HTMLElement$bdo(...)


Method big()

Usage

HTMLElement$big(...)


Method blockquote()

Usage

HTMLElement$blockquote(..., cite)


Method body()

Usage

HTMLElement$body(
  ...,
  onafterprint,
  onbeforeprint,
  onbeforeunload,
  onhashchange,
  onmessage,
  onoffline,
  ononline,
  onpagehide,
  onpageshow,
  onpopstate,
  onredo,
  onresize,
  onstorage,
  onundo,
  onunload
)


Method br()

Usage

HTMLElement$br(...)


Method button()

Usage

HTMLElement$button(
  ...,
  autofocus,
  disabled,
  form,
  formaction,
  formenctype,
  formmethod,
  formnovalidate,
  formtarget,
  name,
  type,
  value
)


Method canvas()

Usage

HTMLElement$canvas(..., height, width)


Method caption()

Usage

HTMLElement$caption(...)


Method cite()

Usage

HTMLElement$cite(...)


Method code()

Usage

HTMLElement$code(...)


Method col()

Usage

HTMLElement$col(..., span)


Method colgroup()

Usage

HTMLElement$colgroup(..., span)


Method command()

Usage

HTMLElement$command(..., checked, disabled, icon, label, radiogroup, type)


Method datalist()

Usage

HTMLElement$datalist(...)


Method dd()

Usage

HTMLElement$dd(...)


Method del()

Usage

HTMLElement$del(..., cite, datetime)


Method details()

Usage

HTMLElement$details(..., open)


Method dfn()

Usage

HTMLElement$dfn(...)


Method dialog()

Usage

HTMLElement$dialog(..., open)


Method div()

Usage

HTMLElement$div(...)


Method dl()

Usage

HTMLElement$dl(...)


Method dt()

Usage

HTMLElement$dt(...)


Method em()

Usage

HTMLElement$em(...)


Method embed()

Usage

HTMLElement$embed(..., height, src, type, width)


Method fieldset()

Usage

HTMLElement$fieldset(..., disabled, form, name)


Method figcaption()

Usage

HTMLElement$figcaption(...)


Method figure()

Usage

HTMLElement$figure(...)


Method footer()

Usage

HTMLElement$footer(...)


Method form()

Usage

HTMLElement$form(
  ...,
  accept_charset,
  action,
  autocomplete,
  enctype,
  method,
  name,
  novalidate,
  target
)


Method h1()

Usage

HTMLElement$h1(...)


Method h2()

Usage

HTMLElement$h2(...)


Method h3()

Usage

HTMLElement$h3(...)


Method h4()

Usage

HTMLElement$h4(...)


Method h5()

Usage

HTMLElement$h5(...)


Method h6()

Usage

HTMLElement$h6(...)


Method head()

Usage

HTMLElement$head(...)


Method header()

Usage

HTMLElement$header(...)


Method hgroup()

Usage

HTMLElement$hgroup(...)


Method hr()

Usage

HTMLElement$hr(...)


Method html()

Usage

HTMLElement$html(..., manifest, xml..lang, xmlns)


Method i()

Usage

HTMLElement$i(...)


Method iframe()

Usage

HTMLElement$iframe(..., height, name, sandbox, seamless, src, srcdoc, width)


Method ilayer()

Usage

HTMLElement$ilayer(...)


Method img()

Usage

HTMLElement$img(..., alt, height, ismap, longdesc, src, usemap, width)


Method input()

Usage

HTMLElement$input(
  ...,
  accept,
  alt,
  autocomplete,
  autofocus,
  checked,
  dirname,
  disabled,
  form,
  formaction,
  formenctype,
  formmethod,
  formnovalidate,
  formtarget,
  height,
  list,
  max,
  maxlength,
  min,
  multiple,
  name,
  pattern,
  placeholder,
  readonly,
  required,
  size,
  src,
  step,
  type,
  value,
  width
)


Method ins()

Usage

HTMLElement$ins(..., cite, datetime)


Method kbd()

Usage

HTMLElement$kbd(...)


Method keygen()

Usage

HTMLElement$keygen(..., autofocus, challenge, disabled, form, keytype, name)


Method label()

Usage

HTMLElement$label(..., for., form)


Method legend()

Usage

HTMLElement$legend(...)


Method li()

Usage

HTMLElement$li(..., value)


Method link()

Usage

HTMLElement$link(..., disabled, href, hreflang, media, rel, sizes, type)


Method main()

Usage

HTMLElement$main(...)


Method map()

Usage

HTMLElement$map(..., name)


Method mark()

Usage

HTMLElement$mark(...)


Method marquee()

Usage

HTMLElement$marquee(
  ...,
  align,
  behavior,
  bgcolor,
  direction,
  height,
  hspace,
  loop,
  scrollamount,
  scrolldelay,
  truespeed,
  vspace,
  width
)


Method menu()

Usage

HTMLElement$menu(..., label, type)


Method meta()

Usage

HTMLElement$meta(..., charset, content, http_equiv, name)


Method meter()

Usage

HTMLElement$meter(..., form, high, low, max, min, optimum, value)


Method nav()

Usage

HTMLElement$nav(...)


Method noscript()

Usage

HTMLElement$noscript(...)


Method object()

Usage

HTMLElement$object(
  ...,
  archive,
  codebase,
  codetype,
  data,
  declare,
  form,
  height,
  name,
  standby,
  type,
  usemap,
  width
)


Method ol()

Usage

HTMLElement$ol(..., reversed, start, type)


Method optgroup()

Usage

HTMLElement$optgroup(..., disabled, label)


Method option()

Usage

HTMLElement$option(..., disabled, label, selected, value)


Method output()

Usage

HTMLElement$output(..., for., form, name)


Method p()

Usage

HTMLElement$p(...)


Method param()

Usage

HTMLElement$param(..., name, value)


Method pre()

Usage

HTMLElement$pre(...)


Method progress()

Usage

HTMLElement$progress(..., form, max, value)


Method q()

Usage

HTMLElement$q(..., cite)


Method rp()

Usage

HTMLElement$rp(...)


Method rt()

Usage

HTMLElement$rt(...)


Method ruby()

Usage

HTMLElement$ruby(...)


Method samp()

Usage

HTMLElement$samp(...)


Method script()

Usage

HTMLElement$script(..., async, charset, defer, src, type)


Method section()

Usage

HTMLElement$section(...)


Method select()

Usage

HTMLElement$select(
  ...,
  autofocus,
  disabled,
  form,
  multiple,
  name,
  required,
  size
)


Method small()

Usage

HTMLElement$small(...)


Method source()

Usage

HTMLElement$source(..., media, src, type)


Method span()

Usage

HTMLElement$span(...)


Method strong()

Usage

HTMLElement$strong(...)


Method style()

Usage

HTMLElement$style(..., disabled, media, scoped, type)


Method sub()

Usage

HTMLElement$sub(...)


Method summary()

Usage

HTMLElement$summary(...)


Method sup()

Usage

HTMLElement$sup(...)


Method table()

Usage

HTMLElement$table(..., border)


Method tbody()

Usage

HTMLElement$tbody(...)


Method td()

Usage

HTMLElement$td(..., colspan, headers, rowspan)


Method template()

Usage

HTMLElement$template(..., content)


Method textarea()

Usage

HTMLElement$textarea(
  ...,
  autofocus,
  cols,
  dirname,
  disabled,
  form,
  label,
  maxlength,
  name,
  placeholder,
  readonly,
  required,
  rows,
  wrap
)


Method tfoot()

Usage

HTMLElement$tfoot(...)


Method th()

Usage

HTMLElement$th(..., colspan, headers, rowspan, scope)


Method thead()

Usage

HTMLElement$thead(...)


Method time()

Usage

HTMLElement$time(..., datetime, pubdate)


Method title()

Usage

HTMLElement$title(...)


Method tr()

Usage

HTMLElement$tr(...)


Method track()

Usage

HTMLElement$track(..., default, kind, label, src, srclang)


Method tt()

Usage

HTMLElement$tt(...)


Method ul()

Usage

HTMLElement$ul(...)


Method var()

Usage

HTMLElement$var(...)


Method video()

Usage

HTMLElement$video(
  ...,
  autoplay,
  controls,
  height,
  loop,
  mediagroup,
  muted,
  poster,
  preload,
  src,
  width
)


Method wbr()

Usage

HTMLElement$wbr(...)


Method new()

Initialise HTMLElement

Usage

HTMLElement$new(name, ...)

Arguments

name

name of node. e.g. "div"

...

Further arguments are attributes and children of this node. See HTMLElement$update()

Returns

self


Method update()

Updates the attributes and children.

Usage

HTMLElement$update(...)

Arguments

...

attributes and children to add to this node

Returns

self


Method append()

Append a child node at the specified position

Usage

HTMLElement$append(..., position = NULL)

Arguments

position

by default at the end of the list of children nodes can be used to set location index

Returns

self


Method add()

Simultaneous create an HTML element and add it as a child node

Usage

HTMLElement$add(name, ...)

Arguments

name

name of node to create

...

attributes and children of this newly created node

Returns

In contrast to most other methods, $add() returns the newly created element, not the document


Method remove()

Remove child objects at the given indicies

Usage

HTMLElement$remove(indicies)

Arguments

indicies

indicies of the children to remove


Method as_character_inner()

Recursively convert this HTMLElement and children to text

Usage

HTMLElement$as_character_inner(..., depth = 0)

Arguments

...

ignored

depth

recursion depth

Returns

single character string


Method as_character()

Recursively convert this HTMLElement and children to text

Usage

HTMLElement$as_character(..., depth = 0, include_declaration = FALSE)

Arguments

...

ignored

depth

recursion depth. default: 0

include_declaration

Include the leading XML declaration? default: FALSE

Returns

single character string


Method print()

Print the HTML string to the terminal

Usage

HTMLElement$print(..., include_declaration = FALSE)

Arguments

...

Extra arguments passed to HTMLElement$as_character()

include_declaration

Include DOCTYPE declaration? default: FALSE


Method save()

Save HTML

Usage

HTMLElement$save(filename, include_declaration = FALSE, ...)

Arguments

filename

filename

include_declaration

Include DOCTYPE declaration? default: FALSE

...

Extra arguments passed to HTMLElement$as_character()


Method copy()

Make a deep copy of this node and its children

Usage

HTMLElement$copy()

Examples

if (FALSE) { HTMLElement$new('div', class = ".big", "DIV contents") }