Skip to content

Commit

Permalink
Avoid another CSS counters bug on IE7.
Browse files Browse the repository at this point in the history
Closes sass#908
  • Loading branch information
mondoreale authored and nex3 committed Sep 6, 2013
1 parent e6e69ec commit adf11a2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc-src/SASS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* Fixed a bug in the output of lists containing unary plus or minus
operations during sass <=> scss conversion.

* Avoid the [IE7 `content: counter` bug][cc bug] with `content: counters` as
well.

## 3.2.10

* Use the Sass logger infrastructure for `@debug` directives.
Expand Down
17 changes: 16 additions & 1 deletion lib/sass/script/functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ def if(condition, if_true, if_false)
end
declare :if, [:condition, :if_true, :if_false]

# This function only exists as a workaround for IE7's [`content:counter`
# This function only exists as a workaround for IE7's [`content: counter`
# bug][bug]. It works identically to any other plain-CSS function, except it
# avoids adding spaces between the argument commas.
#
Expand All @@ -1503,6 +1503,21 @@ def counter(*args)
end
declare :counter, [], :var_args => true

# This function only exists as a workaround for IE7's [`content: counters`
# bug][bug]. It works identically to any other plain-CSS function, except it
# avoids adding spaces between the argument commas.
#
# [bug]: http://jes.st/2013/ie7s-css-breaking-content-counter-bug/
#
# @example
# counters(item, ".") => counters(item,".")
# @overload counters($args...)
# @return [String]
def counters(*args)
Sass::Script::String.new("counters(#{args.map {|a| a.to_s(options)}.join(',')})")
end
declare :counters, [], :var_args => true

private

# This method implements the pattern of transforming a numeric value into
Expand Down
6 changes: 6 additions & 0 deletions test/sass/functions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,12 @@ def test_counter
assert_equal('counter(item,".")', evaluate('counter(item,".")'))
end

def test_counters
assert_equal("counters(foo)", evaluate("counters(foo)"))
assert_equal('counters(item,".")', evaluate('counters(item, ".")'))
assert_equal('counters(item,".")', evaluate('counters(item,".")'))
end

def test_keyword_args_rgb
assert_equal(%Q{white}, evaluate("rgb($red: 255, $green: 255, $blue: 255)"))
end
Expand Down

0 comments on commit adf11a2

Please sign in to comment.