sass 3.2.0.alpha.72 → 3.2.0.alpha.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/REVISION CHANGED
@@ -1 +1 @@
1
- 8a93d8c65baabeb6f3251d560095ff83b52308bf
1
+ db51415a323a4fc284f38881ac839f3bbf5e7e31
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.72
1
+ 3.2.0.alpha.74
@@ -61,7 +61,8 @@ module Sass
61
61
  # by extending this selector with `extends`.
62
62
  # @see CommaSequence#do_extend
63
63
  def do_extend(extends, seen = Set.new)
64
- extends.get(members.to_set).map do |seq, sels|
64
+ Sass::Util.group_by_to_a(extends.get(members.to_set)) {|seq, _| seq}.map do |seq, group|
65
+ sels = group.map {|_, s| s}.flatten
65
66
  # If A {@extend B} and C {...},
66
67
  # seq is A, sels is B, and self is C
67
68
 
data/lib/sass/util.rb CHANGED
@@ -232,6 +232,29 @@ module Sass
232
232
  return hash.sort_by {|k, v| k}
233
233
  end
234
234
 
235
+ # Performs the equivalent of `enum.group_by.to_a`, but with a guaranteed
236
+ # order. Unlike [#hash_to_a], the resulting order isn't sorted key order;
237
+ # instead, it's the same order as `#group_by` has under Ruby 1.9 (key
238
+ # appearance order).
239
+ #
240
+ # @param enum [Enumerable]
241
+ # @return [Array<[Object, Array]>] An array of pairs.
242
+ def group_by_to_a(enum, &block)
243
+ return enum.group_by(&block).to_a unless ruby1_8?
244
+ order = {}
245
+ arr = []
246
+ enum.group_by do |e|
247
+ res = block[e]
248
+ unless order.include?(res)
249
+ order[res] = order.size
250
+ end
251
+ res
252
+ end.each do |key, vals|
253
+ arr[order[key]] = [key, vals]
254
+ end
255
+ arr
256
+ end
257
+
235
258
  # Returns information about the caller of the previous method.
236
259
  #
237
260
  # @param entry [String] An entry in the `#caller` list, or a similarly formatted string
@@ -890,6 +890,17 @@ CSS
890
890
  SCSS
891
891
  end
892
892
 
893
+ def test_redundant_selector_elimination
894
+ assert_equal <<CSS, render(<<SCSS)
895
+ .foo.bar, .x, .y {
896
+ a: b; }
897
+ CSS
898
+ .foo.bar {a: b}
899
+ .x {@extend .foo, .bar}
900
+ .y {@extend .foo, .bar}
901
+ SCSS
902
+ end
903
+
893
904
  ## Long Extendees
894
905
 
895
906
  def test_long_extendee
@@ -120,6 +120,13 @@ class UtilTest < Test::Unit::TestCase
120
120
  lcs([-5, 3, 2, 8], [-4, 1, 8]) {|a, b| (a - b).abs <= 1 && [a, b].max})
121
121
  end
122
122
 
123
+ def test_group_by_to_a
124
+ assert_equal([[1, [1, 3, 5, 7]], [0, [2, 4, 6, 8]]],
125
+ group_by_to_a(1..8) {|i| i % 2})
126
+ assert_equal([[1, [1, 4, 7, 10]], [2, [2, 5, 8, 11]], [0, [3, 6, 9, 12]]],
127
+ group_by_to_a(1..12) {|i| i % 3})
128
+ end
129
+
123
130
  def test_silence_warnings
124
131
  old_stderr, $stderr = $stderr, StringIO.new
125
132
  warn "Out"
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302989
4
+ hash: 592302985
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 72
12
- version: 3.2.0.alpha.72
11
+ - 74
12
+ version: 3.2.0.alpha.74
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-02-09 00:00:00 -05:00
22
+ date: 2012-02-17 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -151,7 +151,6 @@ files:
151
151
  - lib/sass/tree/root_node.rb
152
152
  - lib/sass/tree/rule_node.rb
153
153
  - lib/sass/tree/content_node.rb
154
- - lib/sass/tree/trace_node.rb
155
154
  - lib/sass/tree/variable_node.rb
156
155
  - lib/sass/tree/visitors/base.rb
157
156
  - lib/sass/tree/visitors/check_nesting.rb
@@ -163,6 +162,7 @@ files:
163
162
  - lib/sass/tree/visitors/to_css.rb
164
163
  - lib/sass/tree/warn_node.rb
165
164
  - lib/sass/tree/while_node.rb
165
+ - lib/sass/tree/trace_node.rb
166
166
  - lib/sass/util.rb
167
167
  - lib/sass/util/multibyte_string_scanner.rb
168
168
  - lib/sass/util/subset_map.rb