- From: Manish Goregaokar via GitHub <sysbot+gh@w3.org>
- Date: Fri, 06 Jan 2017 22:09:12 +0000
- To: public-css-archive@w3.org
Manishearth has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-text-3] Don't mince words about aliasing/shorthands with word-wrap == https://drafts.csswg.org/css-text-3/#propdef-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 overflow-wrap. 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: ```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 account
Received on Friday, 6 January 2017 22:09:23 UTC