Skip to content

Commit

Permalink
Fix searching css on empty fragments.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseppstein authored and tenderlove committed Nov 5, 2009
1 parent 2ffddfc commit 84aa2ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/nokogiri/xml/document_fragment.rb
Expand Up @@ -51,7 +51,11 @@ def to_xml *args
###
# Search this fragment. See Nokogiri::XML::Node#css
def css *args
children.css(*args)
if children.any?
children.css(*args)
else
NodeSet.new(document)
end
end

alias :serialize :to_s
Expand Down

0 comments on commit 84aa2ea

Please sign in to comment.