Skip to content

Commit

Permalink
Consolidate specs for @-moz-document and add deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Jun 23, 2018
1 parent d715eef commit 91f0a1e
Show file tree
Hide file tree
Showing 27 changed files with 364 additions and 126 deletions.
17 changes: 17 additions & 0 deletions spec/css/moz_document/README.md
@@ -0,0 +1,17 @@
`@-moz-document` is a Firefox-specific at-rule that was originally based on a
draft of the [CSS Conditional Rules][] module. It's syntactically unusual in
that it defines a url-prefix() "function" that takes an unquoted URL. This can't
be parsed using Sass's normal unknown-at-rule parsing, since it may contain the
characters `//` that should not be interpreted as a single-line comment.

[CSS Conditional Rules]: https://www.w3.org/TR/css3-conditional/

However, support for `@-moz-document` is [being removed from Firefox][] for
security concerns. Sass support for them should be deprecated and eventually
removed; see [issue 2529][] for details. These specs track deprecated support
for the old syntax, as well as the special case of `@-moz-document url-prefix()`
which is still supported at time of writing as a hack for targeting CSS at
Firefox only.

[being removed from Firefox]: https://www.fxsitecompat.com/en-CA/docs/2018/moz-document-support-has-been-dropped-except-for-empty-url-prefix/
[issue 2529]: https://github.com/sass/sass/issues/2529
17 changes: 17 additions & 0 deletions spec/css/moz_document/empty_prefix/expected_output-libsass.css
@@ -0,0 +1,17 @@
@-moz-document url-prefix() {
a {
b: c;
}
}

@-moz-document url-prefix("") {
a {
b: c;
}
}

@-moz-document url-prefix('') {
a {
b: c;
}
}
15 changes: 15 additions & 0 deletions spec/css/moz_document/empty_prefix/expected_output-ruby-sass.css
@@ -0,0 +1,15 @@
@-moz-document url-prefix() {
a {
b: c;
}
}
@-moz-document url-prefix("") {
a {
b: c;
}
}
@-moz-document url-prefix('') {
a {
b: c;
}
}
15 changes: 15 additions & 0 deletions spec/css/moz_document/empty_prefix/expected_output.css
@@ -0,0 +1,15 @@
@-moz-document url-prefix() {
a {
b: c;
}
}
@-moz-document url-prefix("") {
a {
b: c;
}
}
@-moz-document url-prefix("") {
a {
b: c;
}
}
14 changes: 14 additions & 0 deletions spec/css/moz_document/empty_prefix/input.scss
@@ -0,0 +1,14 @@
// An empty url-prefix() should not be deprecated yet, as it's still supported
// in Firefox's release channel at time of writing.

@-moz-document url-prefix() {
a {b: c}
}

@-moz-document url-prefix("") {
a {b: c}
}

@-moz-document url-prefix('') {
a {b: c}
}
69 changes: 69 additions & 0 deletions spec/css/moz_document/functions/interpolated/error
@@ -0,0 +1,69 @@
DEPRECATION WARNING on line 1, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url(#{"sass-lang.com"}) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 4, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url(#{sa + ss}-lang.com) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 7, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url("#{sa + ss}-lang.com") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 11, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url-prefix(#{"http://sass-lang.com/docs"}) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 14, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url-prefix(#{ht + tp}://sass-lang.com/docs) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 17, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url-prefix("#{ht + tp}://sass-lang.com/docs") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 21, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document domain(#{"sass-lang.com"}) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 24, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document domain(#{sa + ss}-lang.com) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 27, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document domain("#{sa + ss}-lang.com") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 31, column 1 of /sass/spec/css/moz_document/functions/interpolated/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document regexp("#{ht + tp}s:.*") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 changes: 50 additions & 0 deletions spec/css/moz_document/functions/interpolated/expected_output.css
@@ -0,0 +1,50 @@
@-moz-document url(sass-lang.com) {
a {
type: unquoted full url;
}
}
@-moz-document url(sass-lang.com) {
a {
type: unquoted partial url;
}
}
@-moz-document url("sass-lang.com") {
a {
type: quoted partial url;
}
}
@-moz-document url-prefix(http://sass-lang.com/docs) {
a {
type: unquoted full url-prefix;
}
}
@-moz-document url-prefix(http://sass-lang.com/docs) {
a {
type: unquoted partial url-prefix;
}
}
@-moz-document url-prefix("http://sass-lang.com/docs") {
a {
type: quoted partial url-prefix;
}
}
@-moz-document domain(sass-lang.com) {
a {
type: unquoted full domain;
}
}
@-moz-document domain(sass-lang.com) {
a {
type: unquoted partial domain;
}
}
@-moz-document domain("sass-lang.com") {
a {
type: quoted partial domain;
}
}
@-moz-document regexp("https:.*") {
a {
type: regexp;
}
}
33 changes: 33 additions & 0 deletions spec/css/moz_document/functions/interpolated/input.scss
@@ -0,0 +1,33 @@
@-moz-document url(#{"sass-lang.com"}) {
a {type: unquoted full url}
}
@-moz-document url(#{sa + ss}-lang.com) {
a {type: unquoted partial url}
}
@-moz-document url("#{sa + ss}-lang.com") {
a {type: quoted partial url}
}

@-moz-document url-prefix(#{"http://sass-lang.com/docs"}) {
a {type: unquoted full url-prefix}
}
@-moz-document url-prefix(#{ht + tp}://sass-lang.com/docs) {
a {type: unquoted partial url-prefix}
}
@-moz-document url-prefix("#{ht + tp}://sass-lang.com/docs") {
a {type: quoted partial url-prefix}
}

@-moz-document domain(#{"sass-lang.com"}) {
a {type: unquoted full domain}
}
@-moz-document domain(#{sa + ss}-lang.com) {
a {type: unquoted partial domain}
}
@-moz-document domain("#{sa + ss}-lang.com") {
a {type: quoted partial domain}
}

@-moz-document regexp("#{ht + tp}s:.*") {
a {type: regexp}
}
3 changes: 3 additions & 0 deletions spec/css/moz_document/functions/interpolated/options.yml
@@ -0,0 +1,3 @@
---
:todo:
- libsass
48 changes: 48 additions & 0 deletions spec/css/moz_document/functions/static/error
@@ -0,0 +1,48 @@
DEPRECATION WARNING on line 1, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url(sass-lang.com) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 4, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url("sass-lang.com") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 8, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url-prefix(http://sass-lang.com/docs) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 11, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url-prefix("http://sass-lang.com/docs") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 15, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document domain(sass-lang.com) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 18, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document domain("sass-lang.com") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

DEPRECATION WARNING on line 22, column 1 of /sass/spec/css/moz_document/functions/static/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document regexp("https:.*") {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 changes: 35 additions & 0 deletions spec/css/moz_document/functions/static/expected_output.css
@@ -0,0 +1,35 @@
@-moz-document url(sass-lang.com) {
a {
type: unquoted url;
}
}
@-moz-document url("sass-lang.com") {
a {
type: quoted url;
}
}
@-moz-document url-prefix(http://sass-lang.com/docs) {
a {
type: unquoted url-prefix;
}
}
@-moz-document url-prefix("http://sass-lang.com/docs") {
a {
type: quoted url-prefix;
}
}
@-moz-document domain(sass-lang.com) {
a {
type: unquoted domain;
}
}
@-moz-document domain("sass-lang.com") {
a {
type: quoted domain;
}
}
@-moz-document regexp("https:.*") {
a {
type: regexp;
}
}
24 changes: 24 additions & 0 deletions spec/css/moz_document/functions/static/input.scss
@@ -0,0 +1,24 @@
@-moz-document url(sass-lang.com) {
a {type: unquoted url}
}
@-moz-document url("sass-lang.com") {
a {type: quoted url}
}

@-moz-document url-prefix(http://sass-lang.com/docs) {
a {type: unquoted url-prefix}
}
@-moz-document url-prefix("http://sass-lang.com/docs") {
a {type: quoted url-prefix}
}

@-moz-document domain(sass-lang.com) {
a {type: unquoted domain}
}
@-moz-document domain("sass-lang.com") {
a {type: quoted domain}
}

@-moz-document regexp("https:.*") {
a {type: regexp}
}
6 changes: 6 additions & 0 deletions spec/css/moz_document/multi_function/error
@@ -0,0 +1,6 @@
DEPRECATION WARNING on line 1, column 1 of /sass/spec/css/moz_document/multi_function/input.scss:
@-moz-document is deprecated and support will be removed from Sass in a future
relase. For details, see http://bit.ly/moz-document.

@-moz-document url(http://www.w3.org/),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8 changes: 8 additions & 0 deletions spec/css/moz_document/multi_function/expected_output.css
@@ -0,0 +1,8 @@
@-moz-document url(http://www.w3.org/),
url-prefix(http://www.w3.org/Style/),
domain(mozilla.org),
regexp("https:.*") {
a {
b: c;
}
}
6 changes: 6 additions & 0 deletions spec/css/moz_document/multi_function/input.scss
@@ -0,0 +1,6 @@
@-moz-document url(http://www.w3.org/),
url-prefix(http://www.w3.org/Style/),
domain(mozilla.org),
regexp("https:.*") {
a {b: c}
}
4 changes: 4 additions & 0 deletions spec/css/moz_document/options.yml
@@ -0,0 +1,4 @@
---
:warning_todo:
- libsass
- ruby-sass

0 comments on commit 91f0a1e

Please sign in to comment.