Skip to content

CSSParse shouldn't be a global object #3

Open

Description

@FremyCompany

You should be able to create various instances with various options and move from there.

Instances should have a way to decide if a declaration is valid or not; so that the styleMap works. If your polyfill recognizes "#ff00ff" but not "#ff00ffff" the second declaration should be ignored in this case ```--color: #ff00ff; --color: #ff00ffff". Well the example is dumb but you got the idea.

Activity

  1. tabatkins commented on May 31, 2016

    @tabatkins
    Collaborator

    Parsing "as CSS" should just parse as CSS; no need for options that I can see.

    Parsing "as generic CSS-ish syntax" shouldn't do any of that error-handling. Blocks containing declarations should just produce a list of declarations, not a StyleMap. Your example should produce a block containing an array of two declarations, each with a name of "--color" and a value that's an array holding a CSSHashToken{value:"ff00ff"} or similar.

    It might be reasonable to be able to pass some options to the generic parser to opt into some things, like last-wins semantics in declarations.

  2. FremyCompany commented on Jun 1, 2016

    @FremyCompany
    ContributorAuthor

    My point was that styleMap.get("--background") should be able to be configured somehow so that the last valid declaration wins, aka you get a callback where you can say what is valid for --background (or any other property).

    If there is like you mention a mode that does not assume last-win, you can disregard this feedback, this behavior can be implemented in the JS-side.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions