Bug 1512956 - Ensure empty string is considered valid CSS authoredText; r=pbro

When removing all declarations from a rule via the Rule view, the authoredText value ends up as an empty string.
This patch ensures that the fallback cssText is not used in that case because that accidentally restores the whole declaration block when re-parsing the text of the rule.

Differential Revision: https://phabricator.services.mozilla.com/D14753
This commit is contained in:
Razvan Caliman
2019-02-24 10:28:14 +00:00
parent e6c0bbac2c
commit ddc3a0b032
5 changed files with 56 additions and 5 deletions

View File

@@ -270,7 +270,7 @@ function cssTrim(str) {
function parseDeclarationsInternal(isCssPropertyKnown, inputString,
parseComments, inComment, commentOverride) {
if (inputString === null || inputString === undefined) {
throw new Error("empty input string");
return [];
}
const lexer = getCSSLexer(inputString);