Skip to content

Some property definitions for shorthands should not say 'see individual properties' #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SebastianZ opened this issue Jun 23, 2016 · 8 comments

Comments

@SebastianZ
Copy link
Contributor

SebastianZ commented Jun 23, 2016

@tabatkins mentioned earlier that shorthands don't have an initial value.

I believe this statement is wrong. Shorthands do have initial values, which are a normally a combination of their longhands. Also, they apply to a specific group of elements, they are inherited or not, they apply to a specific media and have a computed value.

So, their property definitions for 'Initial', 'Applies to', 'Inherited', 'Media' and 'Computed value' should be set accordingly.

Examples:
The font shorthand has an initial value of normal normal normal normal 20px / normal arial (and not one of the possible keyword values), it applies to all elements, it is inherited, applies to visual media and has a computed value of <‘font-style’> <‘font-weight’> <‘font-stretch’> <‘font-size’> / <‘line-height’> <‘font-family’> (browsers are inconsistent regarding that).

The flex shorthand has an initial value of 0 1 auto, it applies to flex items, it is not inherited, applies to visual media anad has a computed value of <‘flex-grow’> <‘flex-shrink’> <‘flex-basis’> (and not none).

Sebastian

@frivoal
Copy link
Collaborator

frivoal commented Jun 23, 2016

I am not sure I understand what it implies for shorthand to be described as having initial values, instead of just defering that to their longhands.

It terms of cascading and inheritance, only longhand initial values matter. The 'initial' keyword can be described in a way that makes it work for shorthand in terms of its longhangs, without them having an independent initial value.

For documentation and teaching purposes, expressing directly what the initial value of a shorthand is may be useful, but it is fully a consequence of the longhand values, not a separate normative requirement, so it feels it would belong in a note of some kind.

Or am I missing something?

@SebastianZ
Copy link
Contributor Author

SebastianZ commented Jun 23, 2016

As far as I know, there is currently no shorthand having a different value as its longhands, though a shorthand may have an initial value that doesn't refer to its longhands.
Take the flex property as example again. It's syntax is defined as:

none | [ <‘flex-grow’> <‘flex-shrink’>? || <‘flex-basis’> ]

It could have had none as initial value, which is not part of the longhands' syntaxes.
@fantasai, maybe you can explain why you changed the initial value of flex from 'see individual properties' to 1 0 auto in 96708b9#diff-9c5fc491cf3bc3eb549a06890ba15b4fL1482.

@frivoal what about the other property definitions mentioned above?

Sebastian

@tabatkins
Copy link
Member

An initial value is used solely to:

  1. Define what initial does (or inherit on a root element).
  2. Define the property's "specified value" when it doesn't have a "cascaded value".

In either case, shorthands don't exist at that time. They go away during parsing, expanded into their constituent longhands. There is nothing for a shorthand's initial value, if it had one, to do.

@frivoal
Copy link
Collaborator

frivoal commented Jun 24, 2016

It could have had none as initial value, which is not part of the longhands' syntaxes.

Whether or not none is part of the longhand's syntax, the shorthand can only have none as an initial value if what none on the shorthand sets the longhands to is their initial value. Anything else is nonsensical.

what about the other property definitions mentioned above?

What about them? The initial values of the flex and font property you describe do not exist independently of the initial values of the longhands. “The initial value of the flex property is 1 0 auto” is nothing more than a shortcut way of saying “The initial values of the flex-grow flex-shrink and flex-basis properties are respectively 1, 0 and auto”.

@SebastianZ
Copy link
Contributor Author

It could have had none as initial value, which is not part of the longhands' syntaxes.

Whether or not none is part of the longhand's syntax, the shorthand can only have none as an initial value if what none on the shorthand sets the longhands to is their initial value. Anything else is nonsensical.

Right, the mapping between the keyword and the initial values of the longhands is obligatory.
Non-the-less would it be a keyword, so only 'see individual properties' would be incorrect in that case.

As we didn't have a precedent for this yet, I'm conviced now that having 'see individual properties' is the right choice here.

what about the other property definitions mentioned above?

What about them? The initial values of the flex and font property you describe do not exist independently of the initial values of the longhands. “The initial value of the flex property is 1 0 auto” is nothing more than a shortcut way of saying “The initial values of the flex-grow flex-shrink and flex-basis properties are respectively 1, 0 and auto”.

I meant 'Applies to', 'Inherited', 'Media' and 'Computed value'.

There must be a reason why the basically all spec. editors do it differently ‒ including Tab's and your specifications ‒ than what @tabatkins wrote in speced/bikeshed#734 (comment).

Sebastian

@tabatkins
Copy link
Member

While I am an editor of Animations, I did not write the spec, and am not directly responsible for that propdef.

(But you might still be able to find one where I did write a shorthand in an inconsistent way; I forget sometimes.)

@tabatkins tabatkins self-assigned this Jun 27, 2016
@fantasai
Copy link
Collaborator

I did that for the flex properties because they are recommended over the longhands in nearly all cases. I don't mind to revert that, though I think it's more helpful to authors when that information is readily available given we don't want authors to even know about the longhands in this case... Note this does not hold true for most other shorthands.

@fantasai
Copy link
Collaborator

The general rule is here: https://lists.w3.org/Archives/Public/www-style/2016May/0044.html, which says “fill in the shorthand propdef table's field if all sub-properties have the same value”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants