1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

[Sass] Deprecate parent refs in the middle of selectors.

This commit is contained in:
Nathan Weizenbaum 2010-04-19 18:37:43 -07:00
parent 083196b152
commit a4a973cc70
2 changed files with 16 additions and 1 deletions

View file

@ -3,6 +3,13 @@
* Table of contents
{:toc}
## 2.2.24 (Unreleased)
* Parent references -- the `&` character --
may only be placed at the beginning of simple selector sequences in Sass 3.
Placing them elsewhere is deprecated in 2.2.24 and will print a warning.
For example, `foo &.bar` is allowed, but `foo .bar&` is not.
## 2.2.23
[Tagged on GitHub](http://github.com/nex3/haml/commit/2.2.23).

View file

@ -202,7 +202,15 @@ module Sass::Tree
while scanner.rest?
rules.last << scanner.scan(/[^",&]*/)
case scanner.scan(/./)
when '&'; rules.last << :parent
when '&'
warn <<END unless rules.last.empty? || rules.last.last =~ /(^|\s)$/
DEPRECATION WARNING:
On line #{@line}#{" of '#{@filename}'" if @filename}
In Sass 3, parent selectors will only be able to appear
at the beginning of simple selector sequences.
For example, ".foo &.bar" is allowed but ".bar&" is not.
END
rules.last << :parent
when ','
scanner.scan(/\s*/)
rules << [] if scanner.rest?