Permalink
Browse files

Merge remote-tracking branch 'origin/stable' into stable

Conflicts:
	doc-src/SASS_CHANGELOG.md
  • Loading branch information...
2 parents 83bc989 + 7709c66 commit 5ce407b94506f53d07297cf24364f8a251a43a9f @nex3 nex3 committed Mar 22, 2013
Showing with 25 additions and 11 deletions.
  1. +1 −1 VERSION
  2. +8 −3 doc-src/SASS_CHANGELOG.md
  3. +1 −1 lib/sass/script/string.rb
  4. +3 −5 lib/sass/scss/rx.rb
  5. +12 −1 test/sass/scss/css_test.rb
View
@@ -1 +1 @@
-3.2.6
+3.2.7
@@ -3,7 +3,12 @@
* Table of contents
{:toc}
-## 3.2.7 (Unreleased)
+## 3.2.8 (Unreleased)
+
+* Fix some edge cases where redundant selectors were emitted when using
+ `@extend`.
+
+## 3.2.7
* The \{Sass::Script::Functions#index `index`} and \{Sass::Script::Functions#zip
`zip`} functions now work like all other list functions and treat individual
@@ -15,8 +20,8 @@
* Emit relative paths when using the `--line-comments` flag of the `sass`
executable.
-* Fix some edge cases where redundant selectors were emitted when using
- `@extend`.
+* Fix a case where very long numbers would cause the SCSS parser to
+ take exponential time.
## 3.2.6
@@ -33,7 +33,7 @@ def plus(other)
# @see Node#to_s
def to_s(opts = {})
if @type == :identifier
- return @value.tr("\n", " ")
+ return @value.gsub(/\s+/, " ")
end
return "\"#{value.gsub('"', "\\\"")}\"" if opts[:quote] == %q{"}
View
@@ -124,11 +124,9 @@ def self.quote(str, flags = 0)
STRING1_NOINTERP = /\"((?:[^\n\r\f\\"#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\"/
STRING2_NOINTERP = /\'((?:[^\n\r\f\\'#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\'/
STRING_NOINTERP = /#{STRING1_NOINTERP}|#{STRING2_NOINTERP}/
- # Can't use IDENT here, because it seems to take exponential time on 1.8.
- # We could use it for 1.9 only, but I don't want to introduce a cross-version
- # behavior difference.
- # In any case, almost all CSS idents will be matched by this.
- STATIC_VALUE = /(-?#{NMSTART}|#{STRING_NOINTERP}|#[a-f0-9]|[,%]|-?#{NUMBER}|\!important)+([;}])/i
+
+ STATIC_COMPONENT = /#{IDENT}|#{STRING_NOINTERP}|#{HEXCOLOR}|[+-]?#{NUMBER}|\!important/i
+ STATIC_VALUE = /#{STATIC_COMPONENT}(\s*[\s,\/]\s*#{STATIC_COMPONENT})*([;}])/i
STATIC_SELECTOR = /(#{NMCHAR}|[ \t]|[,>+*]|[:#.]#{NMSTART}){0,50}([{])/i
end
end
@@ -425,7 +425,7 @@ def test_unary_ops
assert_equal <<CSS, render(<<SCSS)
foo {
a: -0.5em;
- b: 0.5em;
+ b: +0.5em;
c: -foo(12px);
d: +foo(12px); }
CSS
@@ -1011,6 +1011,17 @@ def test_error_with_windows_newlines
## Regressions
+ def test_very_long_number_with_important_doesnt_take_forever
+ assert_equal(<<CSS, render(<<SCSS))
+.foo {
+ width: 97.916666666666666666666666666667% !important; }
+CSS
+.foo {
+ width: 97.916666666666666666666666666667% !important;
+}
+SCSS
+ end
+
def test_selector_without_closing_bracket
assert_not_parses('"]"', "foo[bar <err>{a: b}")
end

0 comments on commit 5ce407b

Please sign in to comment.