class Nokogiri::XML::Element

Public Instance Methods

==(other) click to toggle source

Determines if the element is similar to another element.

@param [Nokogiri::XML::Element] other

The other element.

@return [Boolean]

Specifies whether the element is equal, in identity or value, to
another element.

@api public

Calls superclass method
# File lib/nokogiri/ext/equality/element.rb, line 19
def ==(other)
  return false unless super(other)
  return false unless attribute_nodes.length == other.attribute_nodes.length

  (0...attribute_nodes.length).each do |index|
    attr1 = attribute_nodes[index]
    attr2 = other.attribute_nodes[index]

    return false unless attr1.similar?(attr2)
  end

  return true
end