class Nokogiri::XML::Node
def kwattr_remove(attribute_name, keywords)
node.kwattr_remove("rel", "noreferrer") # => link
node.kwattr_remove("rel", "nofollow") # => link
node # => link
Note that the +rel+ attribute is deleted when empty.
*Example:*
[Returns] +self+ (Node) for ease of chaining method calls.
the attribute is deleted.
in the named attribute will be removed. If no keywords remain, or if +keywords+ is nil,
containing whitespace-delimited values, or an Array of String values. Any keywords present
Keywords to be removed from the attribute named +attribute_name+. May be a string
- +keywords+ (String, Array
- +attribute_name+ (String) The name of the keyword attribute to be modified.
[Parameters]
See also #remove_class, #kwattr_values, #kwattr_add, #kwattr_append
{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
deleted from the node.
If no keywords remain after this operation, or if +keywords+ is +nil+, the attribute is
attribute are removed, including any multiple entries.
Remove keywords from a keyword attribute. Any matching keywords that exist in the named
kwattr_remove(attribute_name, keywords) → self
:call-seq:
def kwattr_remove(attribute_name, keywords) if keywords.nil? remove_attribute(attribute_name) return self end keywords = keywordify(keywords) current_kws = kwattr_values(attribute_name) new_kws = current_kws - keywords if new_kws.empty? remove_attribute(attribute_name) else set_attribute(attribute_name, new_kws.join(" ")) end self end