Skip to content

Replace CSSOM so new CSS features are supported #318

@rockisch

Description

@rockisch

Hi,

I noticed that currently linkedom fails to parse styles with nested CSS rules. Here's a sample code:

import {parseHTML} from "linkedom";

const doc = parseHTML(`
<style>
	.parent { .child { color: red; }}
</style>
`).document;
console.log(doc.children[0].sheet);

Looking into it, it seems like this is an issue with CSSOM, which makes sense considering that project stopped receiving updates 5 years ago and is marked as unmaintained. Although I didn't check, I assume other kinds of 'modern' CSS rules will also raise an exception when parsed.

I would like to know if there is interest in replacing it with an up-to-date CSS parser implementation.

Looking online, I found a benchmark that shows that a few other CSS parsers more or less match the performance of CSSOM, which I know is an important factor for this project.

If this is desired I can take a look into changing the backing implementation, probably trying the projects in the order they appear in that benchmark (I don't know which of those provides the functionalities linkedom requires).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions