haml-edge 2.3.218 → 2.3.219
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/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/sass/selector/sequence.rb +9 -1
- data/lib/sass/selector/simple_sequence.rb +10 -9
- data/test/sass/extend_test.rb +40 -30
- metadata +1 -1
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.219
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.219
|
@@ -79,11 +79,19 @@ module Sass
|
|
79
79
|
def do_extend(extends, supers = [])
|
80
80
|
paths = Haml::Util.paths(members.map do |sseq_or_op|
|
81
81
|
next [[sseq_or_op]] unless sseq_or_op.is_a?(SimpleSequence)
|
82
|
-
|
82
|
+
extended = sseq_or_op.do_extend(extends, supers)
|
83
|
+
choices = extended.map {|seq| seq.members}
|
84
|
+
choices.unshift([sseq_or_op]) unless extended.any? {|seq| seq.superselector?(sseq_or_op)}
|
85
|
+
choices
|
83
86
|
end)
|
84
87
|
Haml::Util.flatten(paths.map {|path| weave(path)}, 1).map {|p| Sequence.new(p)}
|
85
88
|
end
|
86
89
|
|
90
|
+
def superselector?(sseq)
|
91
|
+
return false unless members.size == 1
|
92
|
+
members.last.superselector?(sseq)
|
93
|
+
end
|
94
|
+
|
87
95
|
# @see Simple#to_a
|
88
96
|
def to_a
|
89
97
|
ary = @members.map {|seq_or_op| seq_or_op.is_a?(SimpleSequence) ? seq_or_op.to_a : seq_or_op}
|
@@ -62,21 +62,18 @@ module Sass
|
|
62
62
|
# by extending this selector with `extends`.
|
63
63
|
# @see CommaSequence#do_extend
|
64
64
|
def do_extend(extends, supers = [])
|
65
|
-
|
65
|
+
extends.get(members.to_set).map do |seq, sels|
|
66
66
|
# If A {@extend B} and C {...},
|
67
67
|
# seq is A, sels is B, and self is C
|
68
68
|
|
69
69
|
self_without_sel = self.members - sels
|
70
70
|
next unless unified = seq.members.last.unify(self_without_sel)
|
71
71
|
[sels, seq.members[0...-1] + [unified]]
|
72
|
-
end.compact.map {|sels, seq| [sels, Sequence.new(seq)]}
|
73
|
-
|
74
|
-
|
75
|
-
seqs
|
76
|
-
|
77
|
-
supers.shift
|
78
|
-
new_seqs
|
79
|
-
end.flatten.uniq)
|
72
|
+
end.compact.map {|sels, seq| [sels, Sequence.new(seq)]}.map do |sels, seq|
|
73
|
+
seqs = seq.do_extend(extends, supers.unshift(sels))
|
74
|
+
supers.shift
|
75
|
+
seqs
|
76
|
+
end.flatten.uniq
|
80
77
|
rescue SystemStackError
|
81
78
|
handle_extend_loop(supers)
|
82
79
|
end
|
@@ -102,6 +99,10 @@ module Sass
|
|
102
99
|
SimpleSequence.new(sseq)
|
103
100
|
end
|
104
101
|
|
102
|
+
def superselector?(sseq)
|
103
|
+
(base.nil? || base.eql?(sseq.base)) && rest.subset?(sseq.rest)
|
104
|
+
end
|
105
|
+
|
105
106
|
# @see Simple#to_a
|
106
107
|
def to_a
|
107
108
|
@members.map {|sel| sel.to_a}.flatten
|
data/test/sass/extend_test.rb
CHANGED
@@ -102,7 +102,7 @@ CSS
|
|
102
102
|
SCSS
|
103
103
|
|
104
104
|
assert_equal <<CSS, render(<<SCSS)
|
105
|
-
.foo.bar, .
|
105
|
+
.foo.bar, .baz {
|
106
106
|
a: b; }
|
107
107
|
CSS
|
108
108
|
.foo.bar {a: b}
|
@@ -121,7 +121,7 @@ CSS
|
|
121
121
|
SCSS
|
122
122
|
|
123
123
|
assert_equal <<CSS, render(<<SCSS)
|
124
|
-
.foo.bar, .bar.baz, .
|
124
|
+
.foo.bar, .bar.baz, .baz.bang, .foo.bang {
|
125
125
|
a: b; }
|
126
126
|
CSS
|
127
127
|
.foo.bar {a: b}
|
@@ -190,7 +190,7 @@ CSS
|
|
190
190
|
SCSS
|
191
191
|
|
192
192
|
assert_equal <<CSS, render(<<SCSS)
|
193
|
-
.
|
193
|
+
.baz {
|
194
194
|
a: b; }
|
195
195
|
CSS
|
196
196
|
.foo.baz {a: b}
|
@@ -208,7 +208,7 @@ CSS
|
|
208
208
|
SCSS
|
209
209
|
|
210
210
|
assert_equal <<CSS, render(<<SCSS)
|
211
|
-
|
211
|
+
#baz {
|
212
212
|
a: b; }
|
213
213
|
CSS
|
214
214
|
.foo#baz {a: b}
|
@@ -242,7 +242,7 @@ CSS
|
|
242
242
|
SCSS
|
243
243
|
|
244
244
|
assert_equal <<CSS, render(<<SCSS)
|
245
|
-
.
|
245
|
+
.bar {
|
246
246
|
a: b; }
|
247
247
|
CSS
|
248
248
|
.foo.bar {a: b}
|
@@ -250,7 +250,7 @@ CSS
|
|
250
250
|
SCSS
|
251
251
|
|
252
252
|
assert_equal <<CSS, render(<<SCSS)
|
253
|
-
.
|
253
|
+
.bar {
|
254
254
|
a: b; }
|
255
255
|
CSS
|
256
256
|
.foo.bar {a: b}
|
@@ -268,7 +268,7 @@ SCSS
|
|
268
268
|
|
269
269
|
def test_universal_unification_with_namespaceless_universal_target
|
270
270
|
assert_equal <<CSS, render(<<SCSS)
|
271
|
-
|
271
|
+
* {
|
272
272
|
a: b; }
|
273
273
|
CSS
|
274
274
|
*.foo {a: b}
|
@@ -276,7 +276,7 @@ CSS
|
|
276
276
|
SCSS
|
277
277
|
|
278
278
|
assert_equal <<CSS, render(<<SCSS)
|
279
|
-
|
279
|
+
* {
|
280
280
|
a: b; }
|
281
281
|
CSS
|
282
282
|
*.foo {a: b}
|
@@ -292,7 +292,7 @@ CSS
|
|
292
292
|
SCSS
|
293
293
|
|
294
294
|
assert_equal <<CSS, render(<<SCSS)
|
295
|
-
|
295
|
+
*|* {
|
296
296
|
a: b; }
|
297
297
|
CSS
|
298
298
|
*|*.foo {a: b}
|
@@ -318,7 +318,7 @@ SCSS
|
|
318
318
|
|
319
319
|
def test_universal_unification_with_namespaced_universal_target
|
320
320
|
assert_equal <<CSS, render(<<SCSS)
|
321
|
-
ns
|
321
|
+
ns|* {
|
322
322
|
a: b; }
|
323
323
|
CSS
|
324
324
|
ns|*.foo {a: b}
|
@@ -326,7 +326,7 @@ ns|*.foo {a: b}
|
|
326
326
|
SCSS
|
327
327
|
|
328
328
|
assert_equal <<CSS, render(<<SCSS)
|
329
|
-
ns
|
329
|
+
ns|* {
|
330
330
|
a: b; }
|
331
331
|
CSS
|
332
332
|
ns|*.foo {a: b}
|
@@ -342,7 +342,7 @@ ns2|* {@extend .foo}
|
|
342
342
|
SCSS
|
343
343
|
|
344
344
|
assert_equal <<CSS, render(<<SCSS)
|
345
|
-
ns
|
345
|
+
ns|* {
|
346
346
|
a: b; }
|
347
347
|
CSS
|
348
348
|
ns|*.foo {a: b}
|
@@ -352,7 +352,7 @@ SCSS
|
|
352
352
|
|
353
353
|
def test_universal_unification_with_namespaceless_element_target
|
354
354
|
assert_equal <<CSS, render(<<SCSS)
|
355
|
-
a
|
355
|
+
a {
|
356
356
|
a: b; }
|
357
357
|
CSS
|
358
358
|
a.foo {a: b}
|
@@ -360,7 +360,7 @@ a.foo {a: b}
|
|
360
360
|
SCSS
|
361
361
|
|
362
362
|
assert_equal <<CSS, render(<<SCSS)
|
363
|
-
a
|
363
|
+
a {
|
364
364
|
a: b; }
|
365
365
|
CSS
|
366
366
|
a.foo {a: b}
|
@@ -376,7 +376,7 @@ CSS
|
|
376
376
|
SCSS
|
377
377
|
|
378
378
|
assert_equal <<CSS, render(<<SCSS)
|
379
|
-
*|a
|
379
|
+
*|a {
|
380
380
|
a: b; }
|
381
381
|
CSS
|
382
382
|
*|a.foo {a: b}
|
@@ -402,7 +402,7 @@ SCSS
|
|
402
402
|
|
403
403
|
def test_universal_unification_with_namespaced_element_target
|
404
404
|
assert_equal <<CSS, render(<<SCSS)
|
405
|
-
ns|a
|
405
|
+
ns|a {
|
406
406
|
a: b; }
|
407
407
|
CSS
|
408
408
|
ns|a.foo {a: b}
|
@@ -410,7 +410,7 @@ ns|a.foo {a: b}
|
|
410
410
|
SCSS
|
411
411
|
|
412
412
|
assert_equal <<CSS, render(<<SCSS)
|
413
|
-
ns|a
|
413
|
+
ns|a {
|
414
414
|
a: b; }
|
415
415
|
CSS
|
416
416
|
ns|a.foo {a: b}
|
@@ -426,7 +426,7 @@ ns2|* {@extend .foo}
|
|
426
426
|
SCSS
|
427
427
|
|
428
428
|
assert_equal <<CSS, render(<<SCSS)
|
429
|
-
ns|a
|
429
|
+
ns|a {
|
430
430
|
a: b; }
|
431
431
|
CSS
|
432
432
|
ns|a.foo {a: b}
|
@@ -554,7 +554,7 @@ SCSS
|
|
554
554
|
|
555
555
|
def test_element_unification_with_namespaceless_element_target
|
556
556
|
assert_equal <<CSS, render(<<SCSS)
|
557
|
-
a
|
557
|
+
a {
|
558
558
|
a: b; }
|
559
559
|
CSS
|
560
560
|
a.foo {a: b}
|
@@ -562,7 +562,7 @@ a {@extend .foo}
|
|
562
562
|
SCSS
|
563
563
|
|
564
564
|
assert_equal <<CSS, render(<<SCSS)
|
565
|
-
a
|
565
|
+
a {
|
566
566
|
a: b; }
|
567
567
|
CSS
|
568
568
|
a.foo {a: b}
|
@@ -578,7 +578,7 @@ a {@extend .foo}
|
|
578
578
|
SCSS
|
579
579
|
|
580
580
|
assert_equal <<CSS, render(<<SCSS)
|
581
|
-
*|a
|
581
|
+
*|a {
|
582
582
|
a: b; }
|
583
583
|
CSS
|
584
584
|
*|a.foo {a: b}
|
@@ -612,7 +612,7 @@ SCSS
|
|
612
612
|
|
613
613
|
def test_element_unification_with_namespaced_element_target
|
614
614
|
assert_equal <<CSS, render(<<SCSS)
|
615
|
-
ns|a
|
615
|
+
ns|a {
|
616
616
|
a: b; }
|
617
617
|
CSS
|
618
618
|
ns|a.foo {a: b}
|
@@ -620,7 +620,7 @@ a {@extend .foo}
|
|
620
620
|
SCSS
|
621
621
|
|
622
622
|
assert_equal <<CSS, render(<<SCSS)
|
623
|
-
ns|a
|
623
|
+
ns|a {
|
624
624
|
a: b; }
|
625
625
|
CSS
|
626
626
|
ns|a.foo {a: b}
|
@@ -636,7 +636,7 @@ ns2|a {@extend .foo}
|
|
636
636
|
SCSS
|
637
637
|
|
638
638
|
assert_equal <<CSS, render(<<SCSS)
|
639
|
-
ns|a
|
639
|
+
ns|a {
|
640
640
|
a: b; }
|
641
641
|
CSS
|
642
642
|
ns|a.foo {a: b}
|
@@ -678,7 +678,7 @@ CSS
|
|
678
678
|
SCSS
|
679
679
|
|
680
680
|
assert_equal <<CSS, render(<<SCSS)
|
681
|
-
[foo=bar]
|
681
|
+
[foo=bar] {
|
682
682
|
a: b; }
|
683
683
|
CSS
|
684
684
|
[foo=bar].baz {a: b}
|
@@ -720,7 +720,7 @@ CSS
|
|
720
720
|
SCSS
|
721
721
|
|
722
722
|
assert_equal <<CSS, render(<<SCSS)
|
723
|
-
::foo
|
723
|
+
::foo {
|
724
724
|
a: b; }
|
725
725
|
CSS
|
726
726
|
::foo.baz {a: b}
|
@@ -728,7 +728,7 @@ CSS
|
|
728
728
|
SCSS
|
729
729
|
|
730
730
|
assert_equal <<CSS, render(<<SCSS)
|
731
|
-
::foo(2n+1)
|
731
|
+
::foo(2n+1) {
|
732
732
|
a: b; }
|
733
733
|
CSS
|
734
734
|
::foo(2n+1).baz {a: b}
|
@@ -744,7 +744,7 @@ CSS
|
|
744
744
|
SCSS
|
745
745
|
|
746
746
|
assert_equal <<CSS, render(<<SCSS)
|
747
|
-
:foo
|
747
|
+
:foo {
|
748
748
|
a: b; }
|
749
749
|
CSS
|
750
750
|
:foo.baz {a: b}
|
@@ -844,7 +844,7 @@ CSS
|
|
844
844
|
SCSS
|
845
845
|
|
846
846
|
assert_equal <<CSS, render(<<SCSS)
|
847
|
-
:not(.foo)
|
847
|
+
:not(.foo) {
|
848
848
|
a: b; }
|
849
849
|
CSS
|
850
850
|
:not(.foo).baz {a: b}
|
@@ -852,7 +852,7 @@ CSS
|
|
852
852
|
SCSS
|
853
853
|
|
854
854
|
assert_equal <<CSS, render(<<SCSS)
|
855
|
-
:not([a=b])
|
855
|
+
:not([a=b]) {
|
856
856
|
a: b; }
|
857
857
|
CSS
|
858
858
|
:not([a=b]).baz {a: b}
|
@@ -1100,6 +1100,16 @@ CSS
|
|
1100
1100
|
SCSS
|
1101
1101
|
end
|
1102
1102
|
|
1103
|
+
def test_multiple_extender_merges_with_superset_selector
|
1104
|
+
assert_equal <<CSS, render(<<SCSS)
|
1105
|
+
a.bar.baz, a.foo {
|
1106
|
+
a: b; }
|
1107
|
+
CSS
|
1108
|
+
.foo {@extend .bar; @extend .baz}
|
1109
|
+
a.bar.baz {a: b}
|
1110
|
+
SCSS
|
1111
|
+
end
|
1112
|
+
|
1103
1113
|
private
|
1104
1114
|
|
1105
1115
|
def render(sass, options = {})
|