Permalink
Browse files

skipping non-styleable elements

  • Loading branch information...
1 parent 7b79c59 commit 9a7c3d30035da97b48935cfc0f8ccfff7dde882c @JackDanger committed Jun 12, 2010
Showing with 4 additions and 1 deletion.
  1. +3 −0 lib/inline_styles.rb
  2. +1 −1 test/test_inline_styles.rb
@@ -33,6 +33,9 @@ def apply(css)
end.each do |selector, declarations, spec|
# Find each element matching the given slector
(tree/selector).each do |element|
+
+ next unless element.respond_to?(:[])
+
# Merge any previously-inlined style with the
# latest (higher specificity) one
element['style'] ||= ''
@@ -77,7 +77,7 @@ class TestInlineStyles < Test::Unit::TestCase
<small style="font-size: 14px;">
<img src="i.png" style="border: 1px solid #000;" />
</small>
- </small>
+
</div></body>
NEWHTML
end

0 comments on commit 9a7c3d3

Please sign in to comment.