dart-sass icon indicating copy to clipboard operation
dart-sass copied to clipboard

Drop explicit support for @-moz-document

Open nex3 opened this issue 6 years ago • 6 comments

See https://github.com/sass/sass/issues/2529.

  • [x] Deprecate all syntax other than url-prefix() and url-prefix("").
  • [x] ~~Deprecate all syntax (blocked on Firefox removing support for url-prefix()).~~
  • [x] ~~Remove support entirely (waiting for breaking release).~~
  • [ ] Drop explicit support for @-moz-document and treat it as an unknown at-rule.

nex3 avatar Jun 22 '18 22:06 nex3

Isn't @-moz-document is still used for userstyles? I could try migrating to url-prefix, but afaik userstyle support is still entirely present and not deprecated.

refi64 avatar Jul 21 '19 23:07 refi64

@refi64 Can you use @document there instead? One reason we want to drop support for @-moz-document is that it uses different syntax than @document, which requires special parser support.

nex3 avatar Jul 22 '19 23:07 nex3

Ah apologies, I didn't realize @document worked as well.

refi64 avatar Jul 23 '19 19:07 refi64

@nex3 given that Firefox gave up on removing support for the empty prefix hack (see https://bugzilla.mozilla.org/show_bug.cgi?id=1449753#c17), what is the plan for Sass ?

stof avatar Sep 03 '22 00:09 stof

Dang. In that case, I think what we should do is transition to treating @-moz-document like an unknown at-rule: parse its value as an interpolated declaration value and be done with it. That probably isn't even a breaking change, since only interpolated SassScript is allowed in the first place. I'll update the task list above.

nex3 avatar Sep 06 '22 22:09 nex3

Firefox still allows @-moz-document rules with values other than url-prefix() in its user stylesheet files (userChrome.css and userContent.css), as well as the browser's own internal stylesheets. (Changing them to unprefixed @documents did not seem to work, and according to MDN, even Firefox only supports the prefixed version.) They're also used in the UserCSS format used by the Stylus user stylesheet manager[^1] and similar browser extensions. (In that case, they're being interpreted by the extension rather than the browser engine - which might not even be Firefox - ~but the spec still says to use the -moz--prefixed version~.)

[Edit: Just realized that user styles were mentioned above as supporting @document, and I somehow missed it. Still, userChrome.css and userContent.css do seem to need the prefixed version.]

Would it be feasible to limit the deprecation warning to forms of @-moz-document that are actually syntactically invalid according to the spec, and thus might fail when the explicit parser support is removed from Sass? If I understand correctly, that would be cases where url-prefix or domain has an unquoted argument - and they work just as well with quoted ones.

[^1]: Not to be confused with the CSS preprocessor also named Stylus.

Rhys-T avatar Dec 22 '22 01:12 Rhys-T