lib/scss_lint/linter/shorthand.rb in scss-lint-0.12.0 vs lib/scss_lint/linter/shorthand.rb in scss-lint-0.12.1
- old
+ new
@@ -8,14 +8,11 @@
property_name = node.name.join
return unless SHORTHANDABLE_PROPERTIES.include?(property_name)
case node.value
when Sass::Script::Tree::Literal
- # HACK: node_parent may not be initialized at this point, so we need to
- # set it ourselves
- node.value.value.node_parent = node.value
- check_script_string(property_name, node.value.value)
+ check_script_literal(property_name, node.value)
when Sass::Script::Tree::ListLiteral
check_script_list(property_name, node.value)
end
end
@@ -30,9 +27,21 @@
padding
]
def check_script_list(prop, list)
check_shorthand(prop, list, list.children.map(&:to_sass))
+ end
+
+ def check_script_literal(prop, literal)
+ value = literal.value
+
+ # HACK: node_parent may not be initialized at this point, so we need to
+ # set it ourselves
+ value.node_parent = literal
+
+ if value.is_a?(Sass::Script::Value::String)
+ check_script_string(prop, value)
+ end
end
def check_script_string(prop, script_string)
return unless script_string.type == :identifier