Ignore comment nodes in NodeSet#text.

This commit is contained in:
Yorick Peterse committed 2014-08-22 11:05:39 +02:00
1 parent 99be3182ae
commit ff8a4ad3aa
2 files changed
+9 -7

No files matched your search

+2 -2
View File
@@ -240,7 +240,7 @@ module Oga
alias_method :attr, :attribute
##
# Returns the text of all nodes in the set.
# Returns the text of all nodes in the set, ignoring comment nodes.
#
# @return [String]
#
@@ -248,7 +248,7 @@ module Oga
text = ''
@nodes.each do |node|
if node.respond_to?(:text)
if node.respond_to?(:text) and !node.is_a?(Comment)
text << node.text
end
end