diff options
Diffstat (limited to 'actionpack/lib/action_controller/vendor/html-scanner')
-rw-r--r-- | actionpack/lib/action_controller/vendor/html-scanner/html/node.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb index f0f94d19cc..016603a3e7 100644 --- a/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb +++ b/actionpack/lib/action_controller/vendor/html-scanner/html/node.rb @@ -122,6 +122,18 @@ module HTML #:nodoc: def validate_conditions(conditions) Conditions === conditions ? conditions : Conditions.new(conditions) end + + def ==(node) + return false unless self.class == node.class && children.size == node.children.size + + equivalent = true + + children.size.times do |i| + equivalent &&= children[i] == node.children[i] + end + + equivalent + end class <<self def parse(parent, line, pos, content, strict=true) @@ -238,6 +250,11 @@ module HTML #:nodoc: nil end end + + def ==(node) + return false unless super + content == node.content + end end # A Tag is any node that represents markup. It may be an opening tag, a @@ -465,8 +482,13 @@ module HTML #:nodoc: true end + def ==(node) + return false unless super + return false unless closing == node.closing && self.name == node.name + attributes == node.attributes + end + private - # Match the given value to the given condition. def match_condition(value, condition) case condition |