Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Fix CSS declaration skip after extra semicolon #2023

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Slayer95
Copy link
Contributor

@Slayer95 Slayer95 commented Aug 2, 2017

Fixes #1993

This issue happens because declaration() is called with a token list such as

[";", "margin", ":", "auto"]

The token ; is recognized as an invalid identifier, and the parser advances the token stream until the next semicolon (or closing brace).

With this patch, the parser will advance a single token when meeting either whitespace or a semicolon, thus fixing the issue.

Alternative patches that may be considered:

@kpreid
Copy link
Contributor

kpreid commented Aug 4, 2017

Could you add some test cases to cssparser_test.js?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS sanitizing drops style following an extra semi-colon
2 participants