src code

class method ActiveView.Builder.tag

ActiveView.Builder.tag([content][,attributes][,child_nodes]) → Element
  • content (String | Number | Function): The content to be inserted in the node.
  • attributes (Object): Hash of HTML attributes, must use "className" instead of "class".
  • child_nodes (Array | Element | Function): May be an array of child nodes, a callback function or an Element

This method refers to tag methods, "br", "li", etc not a method named "tag".

tag methods accept a variable number of arguments. You can pass multiple content arguments, attributes hashes or child nodes (as an array or single elements) in any order.

builder.ul(builder.li('a'),builder.li('b'),{className:'my_list'});
builder.ul({className:'my_list'},[builder.li('a'),builder.li('b')]);

Functions that are passed in will be called, and the response treated as an argument, for instance: one of the tag methods:

builder.p('First line',builder.br,'Second Line')

it could also be a class method, or an inline function:

builder.p('First line',my_view_method,'Second Line')