class Nokogiri::XML::Node
def append_class(names)
node.append_class(["section", "header"]) # =>
node.append_class(["section", "header"]) # =>
node # =>
*Example:* Append "section" and "header" to the node's CSS "class" attribute, via an Array argument
node.append_class("section header") # =>
node # =>
Note that the CSS class "section" is appended even though it is already present
*Example:* Append "section" and "header" to the noded's CSS "class" attribute, via a String argument
node.append_class("section") # => # duplicate added!
node.append_class("section") # =>
node # =>
*Example:* Append "section" to the node's CSS "class" attribute
[Returns] +self+ (Node) for ease of chaining method calls.
value. If no "class" attribute exists, one is created.
appended to the "class" attribute even if they are already present in the attribute
whitespace-delimited names, or an Array of String names. All class names passed in will be
CSS class names to be appended to the Node's "class" attribute. May be a string containing
- +names+ (String, Array
[Parameters]
See related: #kwattr_append, #classes, #add_class, #remove_class
node.kwattr_append("class", names)
This is a convenience function and is equivalent to:
Add HTML CSS classes to +self+, regardless of duplication. Compare with #add_class.
:call-seq: append_class(names) → self
def append_class(names) kwattr_append("class", names) end