From af03f8c697bf1c8273def4a1f28c3c0ff40a3d7a Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Tue, 24 Nov 2009 22:19:50 -0800 Subject: [PATCH] [Sass] Move the RootNode error-checking of PropNodes to cssize. --- lib/sass/tree/root_node.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/sass/tree/root_node.rb b/lib/sass/tree/root_node.rb index 10b75086..f20da8ac 100644 --- a/lib/sass/tree/root_node.rb +++ b/lib/sass/tree/root_node.rb @@ -32,6 +32,14 @@ module Sass 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. # # @param args [Array] ignored @@ -41,12 +49,6 @@ module Sass def _to_s(*args) result = String.new 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? child_str = child.to_s(1) result << child_str + (style == :compressed ? '' : "\n")