Class: Nokogiri::XML::Element
- Defined in:
- lib/nokogiri/ext/equality/element.rb
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Determines if the element is similar to another element.
Methods inherited from Node
#traverse_count, #traverse_text
Instance Method Details
#==(other) ⇒ Boolean
Determines if the element is similar to another element.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/nokogiri/ext/equality/element.rb', line 21 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 |