GithubHelp home page GithubHelp logo

Comments (2)

cdoublev avatar cdoublev commented on July 17, 2024

Somewhat related... Sometimes specs:

  • disallow whitespace between component values, like '<', <type-name>, and '>'
  • require whitespace, like between two <complex-selector-unit>s if the <combinator> between them is omitted

But it is not explicitly required after using in using ( <dependency-list> ). Obviously there would be a function if the whitespace was omitted, so this may not be worth clarifying. (Please tell me if I should open a separate issue.)

An omitted whitespace between two symbols, eg. <foo><bar>, does not mean that a whitespace in the input is disallowed. My point is that if whitespaces were defined to be disallowed between an expression defining a function's name and (, a syntax like <function-name>(<declaration-value>#) for <dashed-function> would be unambiguous.

Fwiw, I think this would be confusing and error-prone. A simpler solution is to rewrite with using <dependency-block>.

Also note that disallowing a whitespace before a multiplier or '>', or after '<', sets a precedent whereas <foo> +, while a bit confusing, is unambiguous to parse since multipliers are not allowed to appear unquoted in a value definition.

In my humble experience, spec authors often omit whitespace in various cases:

  • a| b
  • <a><b>
  • [a b ]
  • fn( a b)

They can all be parsed fine. I expect CSS authors to also omit whitespaces. This may be relaxed later, but perhaps they would appreciate some forgiving syntax. I think functions are the only ambiguous case.

from csswg-drafts.

tabatkins avatar tabatkins commented on July 17, 2024

Re: your whitespace comment, there's a bit more, too. Here's the syntax, currently:

&lt;@function> = @function <<function-name>> [ ( <<parameter-list>> ) ]?
	[ using ( <<dependency-list>> ) ]?
	[ returns <<type>> ]?
{
	<<declaration-rule-list>>
}

In addition to the using detail (using () is allowed, using() is illegal), the main parameters are also separate and optional, so @function --foo () is allowed, but @function --foo() is illegal.

This seems odd; in JS, function foo() {...} is, I think, the most common syntactic form (even tho function foo () {...} is allowed in JS, too). I think we should probably at minimum switch to that; possibly we can allow both forms, if useful. This is a novel syntactic form, so even tho it's kinda unprecedented, that might still be acceptable.

@andruud , did you intend to write both of these locations with that whitespace, or was it unintended?

from csswg-drafts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.