1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Move the RootNode error-checking of PropNodes to cssize.

This commit is contained in:
Nathan Weizenbaum 2009-11-24 22:19:50 -08:00
parent affc5c4d1d
commit af03f8c697

View file

@ -32,6 +32,14 @@ module Sass
protected protected
def cssize!(*args)
super
return unless child = children.find {|c| c.is_a?(PropNode)}
message = "Properties aren't allowed at the root of a document." +
child.pseudo_class_selector_message
raise Sass::SyntaxError.new(message, :line => child.line)
end
# Computes the CSS corresponding to this Sass tree. # Computes the CSS corresponding to this Sass tree.
# #
# @param args [Array] ignored # @param args [Array] ignored
@ -41,12 +49,6 @@ module Sass
def _to_s(*args) def _to_s(*args)
result = String.new result = String.new
children.each do |child| children.each do |child|
if child.is_a? PropNode
message = "Properties aren't allowed at the root of a document." +
child.pseudo_class_selector_message
raise Sass::SyntaxError.new(message, :line => child.line)
end
next if child.invisible? next if child.invisible?
child_str = child.to_s(1) child_str = child.to_s(1)
result << child_str + (style == :compressed ? '' : "\n") result << child_str + (style == :compressed ? '' : "\n")