Bug 1889871 - [devtools] Use InspectorCSSParser in advanceValidate. r=devtools-reviewers,bomsy.

Differential Revision: https://phabricator.services.mozilla.com/D206751
This commit is contained in:
Nicolas Chevobbe 2024-04-16 12:12:00 +00:00
parent e7b5a4bb05
commit ca44c8af31

View File

@ -51,11 +51,11 @@ function advanceValidate(keyCode, value, insertionPoint) {
// value. Otherwise it's been inserted in some spot where it has a
// valid meaning, like a comment or string.
value = value.slice(0, insertionPoint) + ";" + value.slice(insertionPoint);
const lexer = getCSSLexer(value);
const lexer = getCSSLexer(value, true);
while (true) {
const token = lexer.nextToken();
if (token.endOffset > insertionPoint) {
if (token.tokenType === "symbol" && token.text === ";") {
if (token.tokenType === "Semicolon") {
// The ";" is a terminator.
return true;
}