sass 3.4.12 → 3.4.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4b73da7dd6f9103e68b1edcb10a59411db18295
4
- data.tar.gz: ac1d03b3da377814ef33bc5ef9e8f58f318571f9
3
+ metadata.gz: 8d20c295937040233d2c011ca20001285180ba16
4
+ data.tar.gz: 6335a222a12384382336d048635bcd0e0b3b473f
5
5
  SHA512:
6
- metadata.gz: 4da9bdb240ed324d5e7ffd69c3f84d78d811060f19949c4c1d534bf71fbce21b87b96e976f80c6f21fe5636d31e2472f9132fc12b9cb82370bd251e1c3f3e8ec
7
- data.tar.gz: 6adddaf3a218472b3eaf4f8a23c6a909dab474f8265088aedee06cbdc6505d948a50d6f29aca9464f9d6786c7f6db3f6f89eaa435a329cddf1bec407a516027f
6
+ metadata.gz: 36072d55532236efa0e689550fddd097ae58e3bfa1e889e609d91fabf31f05b12c02cf04fa2803c0dce1b42ae0f460e110efb55b3614f1205da0daf848b7fee7
7
+ data.tar.gz: 7fd86b668d23751664fb507def2a7dec79ccbb311b756abcded9963a3a5422d4177798e3af9a0db17c8ec5858943bef8302ae6f92cdbe0f12d57b9013431692c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.12
1
+ 3.4.13
@@ -1 +1 @@
1
- 14 February 2015 01:18:18 UTC
1
+ 27 February 2015 02:28:58 UTC
@@ -14,6 +14,13 @@ module Sass
14
14
  def interpolation(warn_for_color = false); nil; end
15
15
  def use_css_import?; true; end
16
16
 
17
+ def block_contents(node, context)
18
+ if node.is_a?(Sass::Tree::DirectiveNode) && node.normalized_name == '@keyframes'
19
+ context = :keyframes
20
+ end
21
+ super(node, context)
22
+ end
23
+
17
24
  def block_child(context)
18
25
  case context
19
26
  when :ruleset
@@ -22,6 +29,8 @@ module Sass
22
29
  directive || ruleset
23
30
  when :directive
24
31
  directive || declaration_or_ruleset
32
+ when :keyframes
33
+ keyframes_ruleset
25
34
  end
26
35
  end
27
36
 
@@ -35,6 +44,12 @@ module Sass
35
44
  block(node(Sass::Tree::RuleNode.new(selector, range(start_pos)), start_pos), :ruleset)
36
45
  end
37
46
 
47
+ def keyframes_ruleset
48
+ start_pos = source_position
49
+ return unless (selector = keyframes_selector)
50
+ block(node(Sass::Tree::KeyframeRuleNode.new(selector.strip), start_pos), :ruleset)
51
+ end
52
+
38
53
  @sass_script_parser = Class.new(Sass::Script::CssParser)
39
54
  @sass_script_parser.send(:include, ScriptParser)
40
55
  end
@@ -260,10 +260,22 @@ module Sass
260
260
  return [seq1] if seq2.empty?
261
261
 
262
262
  seq1, seq2 = seq1.dup, seq2.dup
263
- init = merge_initial_ops(seq1, seq2)
264
- return unless init
265
- fin = merge_final_ops(seq1, seq2)
266
- return unless fin
263
+ return unless (init = merge_initial_ops(seq1, seq2))
264
+ return unless (fin = merge_final_ops(seq1, seq2))
265
+
266
+ # Make sure there's only one root selector in the output.
267
+ root1 = has_root?(seq1.first) && seq1.shift
268
+ root2 = has_root?(seq2.first) && seq2.shift
269
+ if root1 && root2
270
+ return unless (root = root1.unify(root2))
271
+ seq1.unshift root
272
+ seq2.unshift root
273
+ elsif root1
274
+ seq2.unshift root1
275
+ elsif root2
276
+ seq1.unshift root2
277
+ end
278
+
267
279
  seq1 = group_selectors(seq1)
268
280
  seq2 = group_selectors(seq2)
269
281
  lcs = Sass::Util.lcs(seq2, seq1) do |s1, s2|
@@ -274,6 +286,7 @@ module Sass
274
286
  end
275
287
 
276
288
  diff = [[init]]
289
+
277
290
  until lcs.empty?
278
291
  diff << chunks(seq1, seq2) {|s| parent_superselector?(s.first, lcs.first)} << [lcs.shift]
279
292
  seq1.shift
@@ -613,6 +626,11 @@ module Sass
613
626
  "(#{choices.join ', '})"
614
627
  end.join ' '
615
628
  end
629
+
630
+ def has_root?(sseq)
631
+ sseq.is_a?(SimpleSequence) &&
632
+ sseq.members.any? {|sel| sel.is_a?(Pseudo) && sel.normalized_name == "root"}
633
+ end
616
634
  end
617
635
  end
618
636
  end
@@ -72,12 +72,9 @@ module Sass
72
72
  def unify(sels)
73
73
  return sels if sels.any? {|sel2| eql?(sel2)}
74
74
  sels_with_ix = Sass::Util.enum_with_index(sels)
75
- _, i =
76
- if is_a?(Pseudo)
77
- sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && (sels.last.type == :element)}
78
- else
79
- sels_with_ix.find {|sel, _| sel.is_a?(Pseudo)}
80
- end
75
+ if !is_a?(Pseudo) || (sels.last.is_a?(Pseudo) && sels.last.type == :element)
76
+ _, i = sels_with_ix.find {|sel, _| sel.is_a?(Pseudo)}
77
+ end
81
78
  return sels + [self] unless i
82
79
  sels[0...i] + [self] + sels[i..-1]
83
80
  end
@@ -280,6 +280,10 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
280
280
  end
281
281
  end
282
282
 
283
+ def visit_keyframerule(node)
284
+ "#{tab_str}#{node.resolved_value}#{yield}\n"
285
+ end
286
+
283
287
  private
284
288
 
285
289
  def interp_to_src(interp)
@@ -263,6 +263,38 @@ SASS
263
263
  CSS
264
264
  end
265
265
 
266
+ def test_keyframes
267
+ assert_equal(<<SASS, css2sass(<<CSS))
268
+ @keyframes dash
269
+ from
270
+ stroke-dasharray: 1,200
271
+ stroke-dashoffset: 0
272
+
273
+ 50%
274
+ stroke-dasharray: 89,200
275
+ stroke-dashoffset: -35
276
+
277
+ to
278
+ stroke-dasharray: 89,200
279
+ stroke-dashoffset: -124
280
+ SASS
281
+ @keyframes dash {
282
+ from {
283
+ stroke-dasharray: 1,200;
284
+ stroke-dashoffset: 0;
285
+ }
286
+ 50% {
287
+ stroke-dasharray: 89,200;
288
+ stroke-dashoffset: -35;
289
+ }
290
+ to {
291
+ stroke-dasharray: 89,200;
292
+ stroke-dashoffset: -124;
293
+ }
294
+ }
295
+ CSS
296
+ end
297
+
266
298
  # Regressions
267
299
 
268
300
  def test_nesting_with_matching_property
@@ -503,6 +503,16 @@ CSS
503
503
  SCSS
504
504
  end
505
505
 
506
+ def test_root_only_allowed_at_root
507
+ assert_extends(':root .foo', '.bar .baz {@extend .foo}',
508
+ ':root .foo, :root .bar .baz')
509
+ assert_extends('.foo:root .bar', '.baz:root .bang {@extend .bar}',
510
+ '.foo:root .bar, .baz.foo:root .bang')
511
+ assert_extends('html:root .bar', 'xml:root .bang {@extend .bar}', 'html:root .bar')
512
+ assert_extends('.foo:root > .bar .x', '.baz:root .bang .y {@extend .x}',
513
+ '.foo:root > .bar .x, .baz.foo:root > .bar .bang .y')
514
+ end
515
+
506
516
  def test_comma_extendee
507
517
  assert_equal <<CSS, render(<<SCSS)
508
518
  .foo, .baz {
@@ -1338,6 +1348,16 @@ SCSS
1338
1348
 
1339
1349
  # Regression Tests
1340
1350
 
1351
+ def test_extend_with_middle_pseudo
1352
+ assert_equal(<<CSS, render(<<SCSS))
1353
+ .btn:active.focus, :active.focus:before {
1354
+ a: b; }
1355
+ CSS
1356
+ .btn:active.focus {a: b}
1357
+ :before {@extend .btn}
1358
+ SCSS
1359
+ end
1360
+
1341
1361
  def test_extend_parent_selector_suffix
1342
1362
  assert_equal <<CSS, render(<<SCSS)
1343
1363
  .a-b, .c {
@@ -1243,7 +1243,7 @@ SCSS
1243
1243
 
1244
1244
  def assert_directive_parses(param)
1245
1245
  assert_parses <<SCSS
1246
- @keyframes #{param} {
1246
+ @unknown #{param} {
1247
1247
  a: b; }
1248
1248
  SCSS
1249
1249
  end
@@ -3925,6 +3925,22 @@ CSS
3925
3925
  SCSS
3926
3926
  end
3927
3927
 
3928
+ def test_keyword_arg_scope
3929
+ assert_equal <<CSS, render(<<SCSS)
3930
+ .mixed {
3931
+ arg1: default;
3932
+ arg2: non-default; }
3933
+ CSS
3934
+ $arg1: default;
3935
+ $arg2: default;
3936
+ @mixin a-mixin($arg1: $arg1, $arg2: $arg2) {
3937
+ arg1: $arg1;
3938
+ arg2: $arg2;
3939
+ }
3940
+ .mixed { @include a-mixin($arg2: non-default); }
3941
+ SCSS
3942
+ end
3943
+
3928
3944
  def test_passing_required_args_as_a_keyword_arg
3929
3945
  assert_equal <<CSS, render(<<SCSS)
3930
3946
  .mixed {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.12
4
+ version: 3.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natalie Weizenbaum
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-14 00:00:00.000000000 Z
13
+ date: 2015-02-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: yard