sass 3.3.0.alpha.222 → 3.3.0.alpha.224

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Sass
1
+ # Sass [![Gem Version](https://badge.fury.io/rb/sass.png)](http://badge.fury.io/rb/sass)
2
2
 
3
3
  **Sass makes CSS fun again**. Sass is an extension of CSS3,
4
4
  adding nested rules, variables, mixins, selector inheritance, and more.
data/REVISION CHANGED
@@ -1 +1 @@
1
- 0ef77dc0e3cff821aadca09aca98cac46354093d
1
+ 4dfbda0a8021961739f233828fef25363147c4f2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0.alpha.222
1
+ 3.3.0.alpha.224
@@ -1 +1 @@
1
- 30 July 2013 17:39:38 GMT
1
+ 06 August 2013 20:03:17 GMT
@@ -344,19 +344,19 @@ module Sass
344
344
  # A pseudoclass (e.g. `:visited`) or pseudoelement (e.g. `::first-line`) selector.
345
345
  # It can have arguments (e.g. `:nth-child(2n+1)`).
346
346
  class Pseudo < Simple
347
- # The type of the selector.
348
- # `:class` if this is a pseudoclass selector,
349
- # `:element` if it's a pseudoelement.
347
+ # Some psuedo-class-syntax selectors are actually considered
348
+ # pseudo-elements and must be treated differently. This is a list of such
349
+ # selectors
350
350
  #
351
- # @return [Symbol]
352
- attr_reader :type
351
+ # @return [Array<String>]
352
+ ACTUALLY_ELEMENTS = %w[after before first-line first-letter]
353
353
 
354
- # Some psuedo-class-syntax selectors (`:after` and `:before)
355
- # are actually considered pseudo-elements
356
- # and must be at the end of the selector to function properly.
354
+ # Like \{#type}, but returns the type of selector this looks like, rather
355
+ # than the type it is semantically. This only differs from type for
356
+ # selectors in \{ACTUALLY\_ELEMENTS}.
357
357
  #
358
- # @return [Array<String>]
359
- FINAL_SELECTORS = %w[after before]
358
+ # @return [Symbol]
359
+ attr_reader :syntactic_type
360
360
 
361
361
  # The name of the selector.
362
362
  #
@@ -378,18 +378,22 @@ module Sass
378
378
  # @param arg [nil, Array<String, Sass::Script::Tree::Node>] The argument to the selector,
379
379
  # or nil if no argument was given
380
380
  def initialize(type, name, arg)
381
- @type = type
381
+ @syntactic_type = type
382
382
  @name = name
383
383
  @arg = arg
384
384
  end
385
385
 
386
- def final?
387
- type == :class && FINAL_SELECTORS.include?(name.first)
386
+ # The type of the selector. `:class` if this is a pseudoclass selector,
387
+ # `:element` if it's a pseudoelement.
388
+ #
389
+ # @return [Symbol]
390
+ def type
391
+ ACTUALLY_ELEMENTS.include?(name.first) ? :element : syntactic_type
388
392
  end
389
393
 
390
394
  # @see Selector#to_a
391
395
  def to_a
392
- res = [@type == :class ? ":" : "::"] + @name
396
+ res = [syntactic_type == :class ? ":" : "::"] + @name
393
397
  (res << "(").concat(Sass::Util.strip_string_array(@arg)) << ")" if @arg
394
398
  res
395
399
  end
@@ -403,7 +407,6 @@ module Sass
403
407
  sel.is_a?(Pseudo) && sel.type == :element &&
404
408
  (sel.name != self.name || sel.arg != self.arg)
405
409
  end
406
- return sels + [self] if final?
407
410
  super
408
411
  end
409
412
 
@@ -84,7 +84,7 @@ module Sass
84
84
  sels_with_ix = Sass::Util.enum_with_index(sels)
85
85
  _, i =
86
86
  if self.is_a?(Pseudo) || self.is_a?(SelectorPseudoClass)
87
- sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && (sels.last.final? || sels.last.type == :element)}
87
+ sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) && (sels.last.type == :element)}
88
88
  else
89
89
  sels_with_ix.find {|sel, _| sel.is_a?(Pseudo) || sel.is_a?(SelectorPseudoClass)}
90
90
  end
@@ -42,11 +42,16 @@ module Sass
42
42
  @base ||= (members.first if members.first.is_a?(Element) || members.first.is_a?(Universal))
43
43
  end
44
44
 
45
- # Returns the non-base selectors in this sequence.
45
+ def pseudo_elements
46
+ @pseudo_elements ||= (members - [base]).
47
+ select {|sel| sel.is_a?(Pseudo) && sel.type == :element}
48
+ end
49
+
50
+ # Returns the non-base, non-pseudo-class selectors in this sequence.
46
51
  #
47
52
  # @return [Set<Simple>]
48
53
  def rest
49
- @rest ||= Set.new(base ? members[1..-1] : members)
54
+ @rest ||= Set.new(members - [base] - pseudo_elements)
50
55
  end
51
56
 
52
57
  # Whether or not this compound selector is the subject of the parent
@@ -151,7 +156,9 @@ module Sass
151
156
  # @param sseq [SimpleSequence]
152
157
  # @return [Boolean]
153
158
  def superselector?(sseq)
154
- (base.nil? || base.eql?(sseq.base)) && rest.subset?(sseq.rest)
159
+ (base.nil? || base.eql?(sseq.base)) &&
160
+ pseudo_elements.eql?(sseq.pseudo_elements) &&
161
+ rest.subset?(sseq.rest)
155
162
  end
156
163
 
157
164
  # @see Simple#to_a
@@ -202,8 +209,8 @@ MESSAGE
202
209
  end
203
210
 
204
211
  def _eql?(other)
205
- other.base.eql?(self.base) && Sass::Util.set_eql?(other.rest, self.rest) &&
206
- other.subject? == self.subject?
212
+ other.base.eql?(self.base) && other.pseudo_elements == pseudo_elements &&
213
+ Sass::Util.set_eql?(other.rest, self.rest) && other.subject? == self.subject?
207
214
  end
208
215
  end
209
216
  end
@@ -1116,6 +1116,41 @@ SCSS
1116
1116
 
1117
1117
  # Regression Tests
1118
1118
 
1119
+ def test_pseudo_element_superselector
1120
+ # Pseudo-elements shouldn't be removed in superselector calculations.
1121
+ assert_equal <<CSS, render(<<SCSS)
1122
+ a#bar, a#bar::fblthp {
1123
+ a: b; }
1124
+ CSS
1125
+ %x#bar {a: b} // Add an id to make the results have high specificity
1126
+ %y, %y::fblthp {@extend %x}
1127
+ a {@extend %y}
1128
+ SCSS
1129
+
1130
+ # Pseudo-classes can be removed when the second law allows.
1131
+ assert_equal <<CSS, render(<<SCSS)
1132
+ a#bar {
1133
+ a: b; }
1134
+ CSS
1135
+ %x#bar {a: b}
1136
+ %y, %y:fblthp {@extend %x}
1137
+ a {@extend %y}
1138
+ SCSS
1139
+
1140
+ # A few pseudo-elements can be written as pseudo-elements for historical
1141
+ # reasons. See http://www.w3.org/TR/selectors4/#pseudo-elements.
1142
+ %w[first-line first-letter before after].each do |pseudo|
1143
+ assert_equal <<CSS, render(<<SCSS)
1144
+ a#bar, a#bar:#{pseudo} {
1145
+ a: b; }
1146
+ CSS
1147
+ %x#bar {a: b}
1148
+ %y, %y:#{pseudo} {@extend %x}
1149
+ a {@extend %y}
1150
+ SCSS
1151
+ end
1152
+ end
1153
+
1119
1154
  def test_nested_sibling_extend
1120
1155
  assert_equal <<CSS, render(<<SCSS)
1121
1156
  .parent .bar, .parent .foo {
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: 592302769
4
+ hash: 592302797
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
10
  - alpha
11
- - 222
12
- version: 3.3.0.alpha.222
11
+ - 224
12
+ version: 3.3.0.alpha.224
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-07-30 00:00:00 -04:00
22
+ date: 2013-08-06 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -193,10 +193,10 @@ files:
193
193
  - lib/sass/tree/warn_node.rb
194
194
  - lib/sass/tree/while_node.rb
195
195
  - lib/sass/util/multibyte_string_scanner.rb
196
- - lib/sass/util/subset_map.rb
197
- - lib/sass/util/test.rb
198
196
  - lib/sass/util/normalized_map.rb
199
197
  - lib/sass/util/ordered_hash.rb
198
+ - lib/sass/util/subset_map.rb
199
+ - lib/sass/util/test.rb
200
200
  - lib/sass/version.rb
201
201
  - lib/sass/features.rb
202
202
  - bin/sass
@@ -209,8 +209,8 @@ files:
209
209
  - test/sass/engine_test.rb
210
210
  - test/sass/css2sass_test.rb
211
211
  - test/sass/data/hsl-rgb.txt
212
- - test/sass/extend_test.rb
213
212
  - test/sass/exec_test.rb
213
+ - test/sass/extend_test.rb
214
214
  - test/sass/importer_test.rb
215
215
  - test/sass/fixtures/test_staleness_check_across_importers.css
216
216
  - test/sass/fixtures/test_staleness_check_across_importers.scss
@@ -318,8 +318,8 @@ files:
318
318
  - test/sass/templates/warn_imported.sass
319
319
  - test/sass/test_helper.rb
320
320
  - test/sass/util/multibyte_string_scanner_test.rb
321
- - test/sass/util/subset_map_test.rb
322
321
  - test/sass/util/normalized_map_test.rb
322
+ - test/sass/util/subset_map_test.rb
323
323
  - test/sass/source_map_test.rb
324
324
  - test/test_helper.rb
325
325
  - extra/update_watch.rb
@@ -377,8 +377,8 @@ test_files:
377
377
  - test/sass/conversion_test.rb
378
378
  - test/sass/engine_test.rb
379
379
  - test/sass/css2sass_test.rb
380
- - test/sass/extend_test.rb
381
380
  - test/sass/exec_test.rb
381
+ - test/sass/extend_test.rb
382
382
  - test/sass/importer_test.rb
383
383
  - test/sass/functions_test.rb
384
384
  - test/sass/plugin_test.rb
@@ -391,6 +391,6 @@ test_files:
391
391
  - test/sass/scss/scss_test.rb
392
392
  - test/sass/compiler_test.rb
393
393
  - test/sass/util/multibyte_string_scanner_test.rb
394
- - test/sass/util/subset_map_test.rb
395
394
  - test/sass/util/normalized_map_test.rb
395
+ - test/sass/util/subset_map_test.rb
396
396
  - test/sass/source_map_test.rb