W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2017

[csswg-drafts] [css-text-3] Don't mince words about aliasing/shorthands with word-wrap

From: Manish Goregaokar via GitHub <sysbot+gh@w3.org>
Date: Fri, 06 Jan 2017 22:09:12 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-199302582-1483740550-sysbot+gh@w3.org>
Manishearth has just created a new issue for 

== [css-text-3] Don't mince words about aliasing/shorthands with 
word-wrap ==

The spec says:

> For legacy reasons, UAs must treat word-wrap as an alternate name 
for the overflow-wrap property, as if it were a shorthand of 

The "as if it were a shorthand" is a bit hand-wavy, especially since 
"as an alternate name" can mean something else.

In particular, we have two different ways of "aliasing" properties. 
One is by making them shorthands of the aliasee. The other is by 
making them redirect to the other property at parse time.

The difference crops up when doing things like serializing property 
declaration blocks. For example, the following CSS:

    #foo {
        word-wrap: break-word;
        overflow-wrap: break-word;
        align-items: flex-end;
        -webkit-align-items: baseline;
        foobar: baz;

when serialized via `document.styleSheets[0].cssRules[0].cssText` in 
Firefox produces `"#foo { overflow-wrap: break-word; align-items: 
baseline; }"`, whereas in Chrome/Safari it produces `"#foo { 
word-wrap: break-word; overflow-wrap: break-word; align-items: 
baseline; }"`. This means that Firefox implements it as a "redirect 
alias", but Chrome/Safari implement it as a shorthand alias. All of 
them handle `-webkit-align-items` as a "redirect alias".

Browsers already use "redirect aliases" consistently for aliasing 
legacy prefixed properties. This concept of an alias is not defined in
 the spec, but is consistently implemented in browsers as something 
akin to:

If `foo` is an alias for property `bar`:

 - At parse time, if you encounter a property of name `foo`, treat it 
as if it were the name you encountered was of property `bar`
 - In CSSStyleDeclaration add accessors for the alias `foo` that under
 the hood work with property `bar`
 - Nowhere else should there be traces of the name `foo` (including 
during serialization of a declaration block)

The [compat spec _uses_ this concept of 
"aliasing"](https://compat.spec.whatwg.org/#css-simple-aliases), but 
does not define it.

We should either explicitly spec `word-wrap` to be a shorthand, or 
define this other concept of property alias in the spec and use it 
here (and also use it in the compat spec). I personally prefer the 
latter solution since aliasing is currently unspecced but imo 
shouldn't be.

cc @dholbert @dbaron @fantasai 

Please view or discuss this issue at 
https://github.com/w3c/csswg-drafts/issues/866 using your GitHub 
Received on Friday, 6 January 2017 22:09:23 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:07 UTC