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

csstree.lexer.matchProperty doesn't give an error on "filter" property with "blur(4px)empx" #246

Open
istarkov opened this issue Feb 13, 2023 · 0 comments

Comments

@istarkov
Copy link

Example:

import * as csstree from "css-tree";
const ast = csstree.parse("blur(4px)empx", { context: "value" });
const matchResult = csstree.lexer.matchProperty("filter", ast);

console.log(JSON.stringify(matchResult));
Result JSON
{
  "matched": {
    "syntax": { "type": "Property", "name": "filter" },
    "match": [
      {
        "syntax": {
          "type": "Type",
          "name": "-ms-filter-function-list",
          "opts": null
        },
        "match": [
          {
            "syntax": {
              "type": "Type",
              "name": "-ms-filter-function",
              "opts": null
            },
            "match": [
              {
                "syntax": {
                  "type": "Type",
                  "name": "-ms-filter-function-legacy",
                  "opts": null
                },
                "match": [
                  {
                    "syntax": {
                      "type": "Type",
                      "name": "function-token",
                      "opts": null
                    },
                    "match": [
                      {
                        "syntax": null,
                        "token": "blur(",
                        "node": {
                          "type": "Function",
                          "loc": null,
                          "name": "blur",
                          "children": [
                            {
                              "type": "Dimension",
                              "loc": null,
                              "value": "4",
                              "unit": "px"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "syntax": {
                      "type": "Type",
                      "name": "any-value",
                      "opts": null
                    },
                    "match": [
                      {
                        "syntax": null,
                        "token": "4px",
                        "node": {
                          "type": "Dimension",
                          "loc": null,
                          "value": "4",
                          "unit": "px"
                        }
                      }
                    ]
                  },
                  {
                    "syntax": { "type": "Token", "value": ")" },
                    "token": ")",
                    "node": {
                      "type": "Function",
                      "loc": null,
                      "name": "blur",
                      "children": [
                        {
                          "type": "Dimension",
                          "loc": null,
                          "value": "4",
                          "unit": "px"
                        }
                      ]
                    }
                  }
                ]
              }
            ]
          },
          {
            "syntax": {
              "type": "Type",
              "name": "-ms-filter-function",
              "opts": null
            },
            "match": [
              {
                "syntax": {
                  "type": "Type",
                  "name": "-ms-filter-function-legacy",
                  "opts": null
                },
                "match": [
                  {
                    "syntax": {
                      "type": "Type",
                      "name": "ident-token",
                      "opts": null
                    },
                    "match": [
                      {
                        "syntax": null,
                        "token": "empx",
                        "node": {
                          "type": "Identifier",
                          "loc": null,
                          "name": "empx"
                        }
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "iterations": 113,
  "error": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant