class Nokogiri::XML::Node

def kwattr_append(attribute_name, keywords)

Since v1.11.0

node.kwattr_append("rel", ["nofollow", "noreferrer"]) # =>
node # =>

*Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via an Array argument.


node.kwattr_append("rel", "nofollow noreferrer") # =>
node # =>

Note that "nofollow" is appended even though it is already present.

*Example:* Append "nofollow" and "noreferrer" to the +rel+ attribute, via a String argument.

node.kwattr_append("rel", "nofollow") # =>
node.kwattr_append("rel", "nofollow") # =>
node # =>

Note that duplicates are added.

*Example:* Append "nofollow" to the +rel+ attribute.

[Returns] +self+ (Node) for ease of chaining method calls.

named attribute does not exist, it is created.
appended to the named attribute even if they are already present in the attribute. If the
whitespace-delimited values, or an Array of String values. All values passed in will be
Keywords to be added to the attribute named +attribute_name+. May be a string containing
- +keywords+ (String, Array)
- +attribute_name+ (String) The name of the keyword attribute to be modified.
[Parameters]

See also #append_class, #kwattr_values, #kwattr_add, #kwattr_remove

{the "rel" attribute}[https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel].
contain CSS classes. But other keyword attributes exist, for instance
values. Perhaps the most familiar example of this is the HTML "class" attribute used to
A "keyword attribute" is a node attribute that contains a set of space-delimited

#kwattr_add.
Add keywords to a Node's keyword attribute, regardless of duplication. Compare with

kwattr_append(attribute_name, keywords) → self
:call-seq:
def kwattr_append(attribute_name, keywords)
  keywords = keywordify(keywords)
  current_kws = kwattr_values(attribute_name)
  new_kws = (current_kws + keywords).join(" ")
  set_attribute(attribute_name, new_kws)
  self
end