Skip to content

Allow preprocessing of the input stream to be skipped#382

Merged
ylafon merged 1 commit intomainfrom
sideshowbarker/preprocessing-skipping-allow
Oct 30, 2022
Merged

Allow preprocessing of the input stream to be skipped#382
ylafon merged 1 commit intomainfrom
sideshowbarker/preprocessing-skipping-allow

Conversation

@sideshowbarker
Copy link
Copy Markdown
Member

@sideshowbarker sideshowbarker commented Oct 30, 2022

This change adds an optional isPreprocessed boolean parameter to the StyleSheetParser() constructor; if the value of that parameter is true, the steps from https://drafts.csswg.org/css-syntax/#input-preprocessing for preprocessing the input stream are skipped — so UnescapeFilterReader() is not called.

This is useful in a context where the input stream has already been preprocessed — for example, if the contents of the stylesheet being parsed are from an HTML document that has already been parsed by a conformant HTML parser (which is the case, for example, when the https://github.com/validator/validator HTML checker calls the code).

@sideshowbarker sideshowbarker requested a review from ylafon October 30, 2022 09:39
@sideshowbarker sideshowbarker force-pushed the sideshowbarker/preprocessing-skipping-allow branch 2 times, most recently from 4efeabc to 01656fe Compare October 30, 2022 09:49
This change adds an optional isPreprocessed boolean parameter to the
StyleSheetParser() constructor; if the value of that parameter is true,
the steps from https://drafts.csswg.org/css-syntax/#input-preprocessing
for preprocessing the input stream are skipped — so UnescapeFilterReader()
is not called.

This is useful in a context where the input stream has already been
preprocessed — for example, if the contents of the stylesheet being
parsed are from an HTML document that has already been parsed by a
conformant HTML parser (which is the case, for example, when the
https://github.com/validator/validator HTML checker calls the code).
Copy link
Copy Markdown
Member

@ylafon ylafon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to fix the pre-processing if needed, as pre-processing twice shouldn't change as it should be idempotent, but ok to have it as an interim solution.

@ylafon ylafon merged commit ebabe74 into main Oct 30, 2022
@sideshowbarker sideshowbarker deleted the sideshowbarker/preprocessing-skipping-allow branch October 31, 2022 03:41
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

Successfully merging this pull request may close these issues.

2 participants