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-paint-api] Allow inputArguments define optional arguments #763

zheeeng opened this issue Jun 2, 2018 · 1 comment

[css-paint-api] Allow inputArguments define optional arguments #763

zheeeng opened this issue Jun 2, 2018 · 1 comment


Copy link

zheeeng commented Jun 2, 2018

The custom paint requires a color argument.

class MyPaint {
    static get inputArguments() { return ['<color>']; }

    paint(ctx, size, styleMap) {
        // Paint code goes here.

registerPaint('my-paint', MyPaint)

At present, the correct usage is background: paint(my-paint, red).

Wish there is a way to make this color argument be optional: background: paint(my-paint)

Copy link

The Working Group just discussed optional arguments in paint functions, and agreed to the following:

  • RESOLVED: Deferred to L2
The full IRC log of that discussion <fantasai> Topic: optional arguments in paint functions
<TabAtkins> github:
<dbaron> github:
<fantasai> TabAtkins: Somebody wants optional arguments in paint functions
<fantasai> TabAtkins: It's a very reasonable request
<fantasai> TabAtkins: However, this falls under the more general issue of optional bits of syntax in custom properties
<fantasai> TabAtkins: which is currently not allowed because of issues around parsing ambiguity
<fantasai> TabAtkins: So we need disambiguation support first
<fantasai> florian: Is this a hard problem, or we need to sovle it but haven't yet?
<fantasai> TabAtkins: latter
<fantasai> TabAtkins: Definitely not impossible
<fantasai> TabAtkins: Support for more syntaxy things is slated for L2
<fantasai> fantasai: So proposal is close deferred to next level?
<fantasai> TabAtkins: That's what I would like
<fantasai> Rossen: Any other opinions?
<fantasai> RESOLVED: Deferred to L2
<fantasai> fantasai: Is there anything else is needed for the spec?
<fantasai> iank_: No
<fantasai> TabAtkins: TypedOM has changed how it handles image values
<fantasai> TabAtkins: which might affect this, but it's not affecting this spec

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

No branches or pull requests

5 participants