diff --git a/devtools/client/shared/output-parser.js b/devtools/client/shared/output-parser.js index 5202ae3a8e1e..1376d61f1887 100644 --- a/devtools/client/shared/output-parser.js +++ b/devtools/client/shared/output-parser.js @@ -21,7 +21,7 @@ const { LocalizationHelper } = require("resource://devtools/shared/l10n.js"); const STYLE_INSPECTOR_L10N = new LocalizationHelper(STYLE_INSPECTOR_PROPERTIES); // Functions that accept an angle argument. -const ANGLE_TAKING_FUNCTIONS = [ +const ANGLE_TAKING_FUNCTIONS = new Set([ "linear-gradient", "-moz-linear-gradient", "repeating-linear-gradient", @@ -37,17 +37,17 @@ const ANGLE_TAKING_FUNCTIONS = [ "skewX", "skewY", "hue-rotate", -]; +]); // All cubic-bezier CSS timing-function names. -const BEZIER_KEYWORDS = [ +const BEZIER_KEYWORDS = new Set([ "linear", "ease-in-out", "ease-in", "ease-out", "ease", -]; +]); // Functions that accept a color argument. -const COLOR_TAKING_FUNCTIONS = [ +const COLOR_TAKING_FUNCTIONS = new Set([ "linear-gradient", "-moz-linear-gradient", "repeating-linear-gradient", @@ -60,9 +60,14 @@ const COLOR_TAKING_FUNCTIONS = [ "repeating-conic-gradient", "drop-shadow", "color-mix", -]; +]); // Functions that accept a shape argument. -const BASIC_SHAPE_FUNCTIONS = ["polygon", "circle", "ellipse", "inset"]; +const BASIC_SHAPE_FUNCTIONS = new Set([ + "polygon", + "circle", + "ellipse", + "inset", +]); const BACKDROP_FILTER_ENABLED = Services.prefs.getBoolPref( "layout.css.backdrop-filter.enabled" @@ -408,12 +413,12 @@ class OutputParser { const functionName = token.value; const lowerCaseFunctionName = functionName.toLowerCase(); - const isColorTakingFunction = COLOR_TAKING_FUNCTIONS.includes( + const isColorTakingFunction = COLOR_TAKING_FUNCTIONS.has( lowerCaseFunctionName ); if ( isColorTakingFunction || - ANGLE_TAKING_FUNCTIONS.includes(lowerCaseFunctionName) + ANGLE_TAKING_FUNCTIONS.has(lowerCaseFunctionName) ) { // The function can accept a color or an angle argument, and we know // it isn't special in some other way. So, we let it @@ -545,7 +550,7 @@ class OutputParser { }); } else if ( options.expectShape && - BASIC_SHAPE_FUNCTIONS.includes(lowerCaseFunctionName) + BASIC_SHAPE_FUNCTIONS.has(lowerCaseFunctionName) ) { this.#appendShape(functionText, options); } else { @@ -559,7 +564,7 @@ class OutputParser { case "Ident": if ( options.expectCubicBezier && - BEZIER_KEYWORDS.includes(lowerCaseTokenText) + BEZIER_KEYWORDS.has(lowerCaseTokenText) ) { this.#appendCubicBezier(token.text, options); } else if (