Skip to content
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

[css-mixins-1] Problems with public representations of CSSOM values #11908

Open
cdoublev opened this issue Mar 11, 2025 · 0 comments
Open

[css-mixins-1] Problems with public representations of CSSOM values #11908

cdoublev opened this issue Mar 11, 2025 · 0 comments

Comments

@cdoublev
Copy link
Collaborator

They are minors so I hope it is okay if I do not create separate issues.


CSSFunctionRule.name:

name, of type CSSOMString, readonly

The name of the custom function.

Shouldn'it be serialized as an identifier?

--cust\\ om() becomes <function-token> whose value is cust om, and <)-token>. Then these tokens become a function whose name is cust om.

The same question applies to FunctionParameter.name.


CSSFunctionRule.returnType:

returnType, of type CSSOMString, readonly

The return type of the custom function, represented as a syntax string. If the custom function has no return type, returns "type(*)".

CSSFunctionRule.returnsType may be internally represented as a <type()> (the result from parsing returns <css-type>) unless otherwise specified, and thus would not represent a valid syntax string.

So I would first suggest:

The return type of the custom function:

  • if it is a <syntax-component>, represented as a syntax string
  • if it is a <type()>, represented as its value as a syntax string
  • if it is not defined, as *.

Now I do not see why it should be represented as a syntax string rather than the serialization of <css-type>. Is it intentional? Plugging it in @property/syntax (the only value defined with a syntax <string>) does not seem useful. I would have thought that representing a syntax as a <string> would become legacy.

The same problem/question applies to FunctionParameter.type.


Serialize a function parameter:

  1. If the function parameter has a type, and that type is not the universal syntax definition:

The universal syntax definitions is (implicitly) defined as the value *, which is not a valid function parameter type value.

This intent is unambiguous, of course, but this and the other points above make me wonder if the spec expects implementations to store syntaxes unwrapped from type().

  1. If the function parameter has a default value:

    A single COLON (U+003A), followed by a single SPACE (U+0020), followed by the result of performing serialize a CSS value on that value.

Serialize a CSS value is intended for declarations whereas <function-parameter> may look like a declaration but its value is optional and it may also have a type. Should it be serialize a CSS component value instead?

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

1 participant