sass 3.3.0.alpha.177 → 3.3.0.alpha.181

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
- 1325a12884dbb483f07f2b8ba3ba0526f8148366
1
+ dca1498acda9d3549cc10e87045f75516e494284
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0.alpha.177
1
+ 3.3.0.alpha.181
@@ -1 +1 @@
1
- 10 June 2013 16:41:26 GMT
1
+ 17 June 2013 21:59:02 GMT
@@ -352,7 +352,7 @@ ERR
352
352
  compressed = @options[:style] == :compressed
353
353
  rendered << "\n" if rendered[-1] != ?\n
354
354
  rendered << "\n" unless compressed
355
- rendered << "/*@ sourceMappingURL="
355
+ rendered << "/*# sourceMappingURL="
356
356
  rendered << Sass::Util.escape_uri(sourcemap_uri)
357
357
  rendered << " */"
358
358
  rendered = encode_and_set_charset(rendered)
@@ -1481,28 +1481,30 @@ module Sass::Script
1481
1481
  # Gets the nth item in a list.
1482
1482
  #
1483
1483
  # Note that unlike some languages, the first item in a Sass list is number 1,
1484
- # the second number 2, and so forth.
1484
+ # the second number 2, and so forth. You can also use negative numbers to
1485
+ # count from the end of the list. So -1 is the last item, -2 is the
1486
+ # second-to-last item, etc.
1485
1487
  #
1486
1488
  # @example
1487
1489
  # nth(10px 20px 30px, 1) => 10px
1488
1490
  # nth((Helvetica, Arial, sans-serif), 3) => sans-serif
1491
+ # nth((red, green, blue), -2) => green
1489
1492
  # @param list [Value] The list
1490
1493
  # @param n [Sass::Script::Value::Number] The index into the list
1491
1494
  # @return [Sass::Script::Value::Base] The nth item in the list
1492
- # @raise [ArgumentError] If `n` isn't an integer between 1 and the list's length.
1495
+ # @raise [ArgumentError] If `n` isn't an integer whose absolute value is between 1 and the list's length.
1493
1496
  def nth(list, n)
1494
1497
  assert_type n, :Number
1495
- if !n.int?
1496
- raise ArgumentError.new("List index #{n} must be an integer")
1497
- elsif n.to_i < 1
1498
- raise ArgumentError.new("List index #{n} must be greater than or equal to 1")
1498
+ if !n.int? || n.to_i == 0
1499
+ raise ArgumentError.new("List index #{n} must be a non-zero integer")
1499
1500
  elsif list.to_a.size == 0
1500
1501
  raise ArgumentError.new("List index is #{n} but list has no items")
1501
- elsif n.to_i > (size = list.to_a.size)
1502
+ elsif n.to_i.abs > (size = list.to_a.size)
1502
1503
  raise ArgumentError.new("List index is #{n} but list is only #{size} item#{'s' if size != 1} long")
1503
1504
  end
1504
1505
 
1505
- list.to_a[n.to_i - 1]
1506
+ index = n.to_i > 0 ? n.to_i - 1 : n.to_i
1507
+ list.to_a[index]
1506
1508
  end
1507
1509
  declare :nth, [:list, :n]
1508
1510
 
@@ -437,15 +437,21 @@ module Sass
437
437
  # @param seqses [Array<Array<Array<SimpleSequence or String>>>]
438
438
  # @return [Array<Array<Array<SimpleSequence or String>>>]
439
439
  def trim(seqses)
440
- # Avoid truly horrific quadratic behavior. TOOD: I think there
440
+ # Avoid truly horrific quadratic behavior. TODO: I think there
441
441
  # may be a way to get perfect trimming without going quadratic.
442
442
  return seqses if seqses.size > 100
443
+
444
+ # Keep the results in a separate array so we can be sure we aren't
445
+ # comparing against an already-trimmed selector. This ensures that two
446
+ # identical selectors don't mutually trim one another.
447
+ result = seqses.dup
448
+
443
449
  # This is n^2 on the sequences, but only comparing between
444
450
  # separate sequences should limit the quadratic behavior.
445
- seqses.map do |seqs1|
446
- seqs1.reject do |seq1|
451
+ seqses.each_with_index do |seqs1, i|
452
+ result[i] = seqs1.reject do |seq1|
447
453
  min_spec = _sources(seq1).map {|seq| seq.specificity}.min || 0
448
- seqses.any? do |seqs2|
454
+ result.any? do |seqs2|
449
455
  next if seqs1.equal?(seqs2)
450
456
  # Second Law of Extend: the specificity of a generated selector
451
457
  # should never be less than the specificity of the extending
@@ -456,6 +462,7 @@ module Sass
456
462
  end
457
463
  end
458
464
  end
465
+ result
459
466
  end
460
467
 
461
468
  def _hash
@@ -1116,6 +1116,43 @@ SCSS
1116
1116
 
1117
1117
  # Regression Tests
1118
1118
 
1119
+ def test_nested_sibling_extend
1120
+ assert_equal <<CSS, render(<<SCSS)
1121
+ .parent .bar, .parent .foo {
1122
+ width: 2000px; }
1123
+ CSS
1124
+ .foo {@extend .bar}
1125
+
1126
+ .parent {
1127
+ .bar {
1128
+ width: 2000px;
1129
+ }
1130
+ .foo {
1131
+ @extend .bar
1132
+ }
1133
+ }
1134
+ SCSS
1135
+ end
1136
+
1137
+ def test_parent_and_sibling_extend
1138
+ assert_equal <<CSS, render(<<SCSS)
1139
+ .parent1 .parent2 .child1.child2, .parent2 .parent1 .child1.child2 {
1140
+ c: d; }
1141
+ CSS
1142
+ %foo %bar%baz {c: d}
1143
+
1144
+ .parent1 {
1145
+ @extend %foo;
1146
+ .child1 {@extend %bar}
1147
+ }
1148
+
1149
+ .parent2 {
1150
+ @extend %foo;
1151
+ .child2 {@extend %baz}
1152
+ }
1153
+ SCSS
1154
+ end
1155
+
1119
1156
  def test_nested_extend_specificity
1120
1157
  assert_equal <<CSS, render(<<SCSS)
1121
1158
  a :b, a :b:c {
@@ -1017,12 +1017,14 @@ MSG
1017
1017
  def test_nth
1018
1018
  assert_equal("1", evaluate("nth(1 2 3, 1)"))
1019
1019
  assert_equal("2", evaluate("nth(1 2 3, 2)"))
1020
+ assert_equal("3", evaluate("nth(1 2 3, -1)"))
1021
+ assert_equal("1", evaluate("nth(1 2 3, -3)"))
1020
1022
  assert_equal("3", evaluate("nth((1, 2, 3), 3)"))
1021
1023
  assert_equal("foo", evaluate("nth(foo, 1)"))
1022
1024
  assert_equal("bar baz", evaluate("nth(foo (bar baz) bang, 2)"))
1023
- assert_error_message("List index 0 must be greater than or equal to 1 for `nth'", "nth(foo, 0)")
1024
- assert_error_message("List index -10 must be greater than or equal to 1 for `nth'", "nth(foo, -10)")
1025
- assert_error_message("List index 1.5 must be an integer for `nth'", "nth(foo, 1.5)")
1025
+ assert_error_message("List index 0 must be a non-zero integer for `nth'", "nth(foo, 0)")
1026
+ assert_error_message("List index is -10 but list is only 1 item long for `nth'", "nth(foo, -10)")
1027
+ assert_error_message("List index 1.5 must be a non-zero integer for `nth'", "nth(foo, 1.5)")
1026
1028
  assert_error_message("List index is 5 but list is only 4 items long for `nth'", "nth(1 2 3 4, 5)")
1027
1029
  assert_error_message("List index is 2 but list is only 1 item long for `nth'", "nth(foo, 2)")
1028
1030
  assert_error_message("List index is 1 but list has no items for `nth'", "nth((), 1)")
@@ -24,7 +24,7 @@ a {
24
24
  /* SOME COMMENT */
25
25
  font-size: 12px; }
26
26
 
27
- /*@ sourceMappingURL=test.css.map */
27
+ /*# sourceMappingURL=test.css.map */
28
28
  CSS
29
29
  {
30
30
  "version": "3",
@@ -47,7 +47,7 @@ a {
47
47
  /* SOME COMMENT */
48
48
  font-size: 12px; }
49
49
 
50
- /*@ sourceMappingURL=test.css.map */
50
+ /*# sourceMappingURL=test.css.map */
51
51
  CSS
52
52
  {
53
53
  "version": "3",
@@ -72,7 +72,7 @@ a {
72
72
  /* SOME COMMENT */
73
73
  font-size: 12px; }
74
74
 
75
- /*@ sourceMappingURL=style.css.map */
75
+ /*# sourceMappingURL=style.css.map */
76
76
  CSS
77
77
  {
78
78
  "version": "3",
@@ -96,7 +96,7 @@ a {
96
96
  /* SOME COMMENT */
97
97
  font-size: 12px; }
98
98
 
99
- /*@ sourceMappingURL=style.css.map */
99
+ /*# sourceMappingURL=style.css.map */
100
100
  CSS
101
101
  {
102
102
  "version": "3",
@@ -118,7 +118,7 @@ SCSS
118
118
  a {
119
119
  fóó: bár; }
120
120
 
121
- /*@ sourceMappingURL=test.css.map */
121
+ /*# sourceMappingURL=test.css.map */
122
122
  CSS
123
123
  {
124
124
  "version": "3",
@@ -138,7 +138,7 @@ SASS
138
138
  a {
139
139
  fóó: bár; }
140
140
 
141
- /*@ sourceMappingURL=test.css.map */
141
+ /*# sourceMappingURL=test.css.map */
142
142
  CSS
143
143
  {
144
144
  "version": "3",
@@ -160,7 +160,7 @@ SCSS
160
160
  f\x86\x86 {
161
161
  \x86: b; }
162
162
 
163
- /*@ sourceMappingURL=test.css.map */
163
+ /*# sourceMappingURL=test.css.map */
164
164
  CSS
165
165
  {
166
166
  "version": "3",
@@ -181,7 +181,7 @@ SASS
181
181
  f\x86\x86 {
182
182
  \x86: b; }
183
183
 
184
- /*@ sourceMappingURL=test.css.map */
184
+ /*# sourceMappingURL=test.css.map */
185
185
  CSS
186
186
  {
187
187
  "version": "3",
@@ -203,7 +203,7 @@ SCSS
203
203
  {{3}}@import url(bar){{/3}};
204
204
  {{4}}@import url(baz) screen print{{/4}};
205
205
 
206
- /*@ sourceMappingURL=test.css.map */
206
+ /*# sourceMappingURL=test.css.map */
207
207
  CSS
208
208
  end
209
209
 
@@ -219,7 +219,7 @@ SASS
219
219
  {{4}}@import url(baz.css){{/4}};
220
220
  {{5}}@import url(qux.css) screen print{{/5}};
221
221
 
222
- /*@ sourceMappingURL=test.css.map */
222
+ /*# sourceMappingURL=test.css.map */
223
223
  CSS
224
224
  end
225
225
 
@@ -235,7 +235,7 @@ SCSS
235
235
  {{2}}body{{/2}} {
236
236
  {{3}}max-width{{/3}}: {{4}}1070px{{/4}}; } }
237
237
 
238
- /*@ sourceMappingURL=test.css.map */
238
+ /*# sourceMappingURL=test.css.map */
239
239
  CSS
240
240
  end
241
241
 
@@ -249,7 +249,7 @@ SASS
249
249
  {{2}}body{{/2}} {
250
250
  {{3}}max-width{{/3}}: {{4}}1070px{{/4}}; } }
251
251
 
252
- /*@ sourceMappingURL=test.css.map */
252
+ /*# sourceMappingURL=test.css.map */
253
253
  CSS
254
254
  end
255
255
 
@@ -279,7 +279,7 @@ SCSS
279
279
  {{7}}border-color{{/7}}: {{8}}blue{{/8}};
280
280
  {{9}}font{{/9}}: {{10}}12px/30px{{/10}}; }
281
281
 
282
- /*@ sourceMappingURL=test.css.map */
282
+ /*# sourceMappingURL=test.css.map */
283
283
  CSS
284
284
  end
285
285
 
@@ -307,7 +307,7 @@ SASS
307
307
  {{7}}border-color{{/7}}: {{8}}blue{{/8}};
308
308
  {{9}}font{{/9}}: {{10}}12px/30px{{/10}}; }
309
309
 
310
- /*@ sourceMappingURL=test.css.map */
310
+ /*# sourceMappingURL=test.css.map */
311
311
  CSS
312
312
  end
313
313
 
@@ -355,7 +355,7 @@ SCSS
355
355
  {{22}}color{{/22}}: {{23}}#050709{{/23}};
356
356
  {{24}}border{{/24}}: {{25}}2px solid black{{/25}}; }
357
357
 
358
- /*@ sourceMappingURL=test.css.map */
358
+ /*# sourceMappingURL=test.css.map */
359
359
  CSS
360
360
  end
361
361
 
@@ -398,7 +398,7 @@ SASS
398
398
  {{22}}color{{/22}}: {{23}}#050709{{/23}};
399
399
  {{24}}border{{/24}}: {{25}}2px solid black{{/25}}; }
400
400
 
401
- /*@ sourceMappingURL=test.css.map */
401
+ /*# sourceMappingURL=test.css.map */
402
402
  CSS
403
403
  end
404
404
 
@@ -420,7 +420,7 @@ SCSS
420
420
  {{6}}.seriousError{{/6}} {
421
421
  {{7}}border-width{{/7}}: {{8}}3px{{/8}}; }
422
422
 
423
- /*@ sourceMappingURL=test.css.map */
423
+ /*# sourceMappingURL=test.css.map */
424
424
  CSS
425
425
  end
426
426
 
@@ -441,7 +441,7 @@ SASS
441
441
  {{6}}.seriousError{{/6}} {
442
442
  {{7}}border-width{{/7}}: {{8}}3px{{/8}}; }
443
443
 
444
- /*@ sourceMappingURL=test.css.map */
444
+ /*# sourceMappingURL=test.css.map */
445
445
  CSS
446
446
  end
447
447
 
@@ -460,7 +460,7 @@ SCSS
460
460
  {{7}}.item-3{{/7}} {
461
461
  {{8}}width{{/8}}: {{9}}6em{{/9}}; }
462
462
 
463
- /*@ sourceMappingURL=test.css.map */
463
+ /*# sourceMappingURL=test.css.map */
464
464
  CSS
465
465
  end
466
466
 
@@ -479,7 +479,7 @@ SASS
479
479
  {{7}}.item-3{{/7}} {
480
480
  {{8}}width{{/8}}: {{9}}6em{{/9}}; }
481
481
 
482
- /*@ sourceMappingURL=test.css.map */
482
+ /*# sourceMappingURL=test.css.map */
483
483
  CSS
484
484
  end
485
485
 
@@ -500,7 +500,7 @@ SCSS
500
500
  {{7}}.item-2{{/7}} {
501
501
  {{8}}width{{/8}}: {{9}}4em{{/9}}; }
502
502
 
503
- /*@ sourceMappingURL=test.css.map */
503
+ /*# sourceMappingURL=test.css.map */
504
504
  CSS
505
505
  end
506
506
 
@@ -521,7 +521,7 @@ SASS
521
521
  {{7}}.item-2{{/7}} {
522
522
  {{8}}width{{/8}}: {{9}}4em{{/9}}; }
523
523
 
524
- /*@ sourceMappingURL=test.css.map */
524
+ /*# sourceMappingURL=test.css.map */
525
525
  CSS
526
526
  end
527
527
 
@@ -545,7 +545,7 @@ SCSS
545
545
  {{10}}.salamander-icon{{/10}} {
546
546
  {{11}}background-image{{/11}}: {{12}}url("/images/salamander.png"){{/12}}; }
547
547
 
548
- /*@ sourceMappingURL=test.css.map */
548
+ /*# sourceMappingURL=test.css.map */
549
549
  CSS
550
550
  end
551
551
 
@@ -567,7 +567,7 @@ SASS
567
567
  {{10}}.salamander-icon{{/10}} {
568
568
  {{11}}background-image{{/11}}: {{12}}url("/images/salamander.png"){{/12}}; }
569
569
 
570
- /*@ sourceMappingURL=test.css.map */
570
+ /*# sourceMappingURL=test.css.map */
571
571
  CSS
572
572
  end
573
573
 
@@ -628,7 +628,7 @@ SCSS
628
628
  {{27}}-webkit-box-shadow{{/27}}: {{28}}0px 4px 5px #666666, 2px 6px 10px #999999{{/28}};
629
629
  {{29}}box-shadow{{/29}}: {{30}}0px 4px 5px #666666, 2px 6px 10px #999999{{/30}}; }
630
630
 
631
- /*@ sourceMappingURL=test.css.map */
631
+ /*# sourceMappingURL=test.css.map */
632
632
  CSS
633
633
  end
634
634
 
@@ -685,7 +685,7 @@ SASS
685
685
  {{27}}-webkit-box-shadow{{/27}}: {{28}}0px 4px 5px #666666, 2px 6px 10px #999999{{/28}};
686
686
  {{29}}box-shadow{{/29}}: {{30}}0px 4px 5px #666666, 2px 6px 10px #999999{{/30}}; }
687
687
 
688
- /*@ sourceMappingURL=test.css.map */
688
+ /*# sourceMappingURL=test.css.map */
689
689
  CSS
690
690
  end
691
691
 
@@ -702,7 +702,7 @@ SCSS
702
702
  {{1}}sidebar{{/1}} {
703
703
  {{2}}width{{/2}}: {{3}}120px{{/3}}; }
704
704
 
705
- /*@ sourceMappingURL=test.css.map */
705
+ /*# sourceMappingURL=test.css.map */
706
706
  CSS
707
707
  end
708
708
 
@@ -720,7 +720,7 @@ SASS
720
720
  {{1}}sidebar{{/1}} {
721
721
  {{2}}width{{/2}}: {{3}}120px{{/3}}; }
722
722
 
723
- /*@ sourceMappingURL=test.css.map */
723
+ /*# sourceMappingURL=test.css.map */
724
724
  CSS
725
725
  end
726
726
 
@@ -740,7 +740,7 @@ SASS
740
740
  {{6}}name{{/6}}: {{7}}value{{/7}};
741
741
  {{8}}name{{/8}}: {{9}}value{{/9}}; }
742
742
 
743
- /*@ sourceMappingURL=test.css.map */
743
+ /*# sourceMappingURL=test.css.map */
744
744
  CSS
745
745
  end
746
746
 
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: 592302703
4
+ hash: 592302695
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
10
  - alpha
11
- - 177
12
- version: 3.3.0.alpha.177
11
+ - 181
12
+ version: 3.3.0.alpha.181
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: 2013-06-10 00:00:00 -04:00
22
+ date: 2013-06-17 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -267,6 +267,7 @@ files:
267
267
  - test/sass/templates/bork2.sass
268
268
  - test/sass/templates/bork3.sass
269
269
  - test/sass/templates/bork4.sass
270
+ - test/sass/templates/bork5.sass
270
271
  - test/sass/templates/cached_import_option.scss
271
272
  - test/sass/templates/compact.sass
272
273
  - test/sass/templates/complex.sass
@@ -308,7 +309,6 @@ files:
308
309
  - test/sass/templates/units.sass
309
310
  - test/sass/templates/warn.sass
310
311
  - test/sass/templates/warn_imported.sass
311
- - test/sass/templates/bork5.sass
312
312
  - test/sass/test_helper.rb
313
313
  - test/sass/util/multibyte_string_scanner_test.rb
314
314
  - test/sass/util/subset_map_test.rb