Closed Bug 1840320 Opened 1 year ago Closed 5 months ago

Add InspectorUtils.parseCSSDeclarations

Categories

(DevTools :: Inspector, task)

task

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: nchevobbe, Unassigned)

References

Details

This new methods would replace DevTools custom parseDeclarationsInternal (parsing-utils.js)

The function takes a string input which represent the "body" of a rule and returns an array of declarations object, with the following properties:

  • {String} name: The name of the property
  • {String} value: The value for the property
  • {String} priority: "important" or empty string (this one could be turned into an boolean important property I guess? Not sure why we have it as a string)
  • {String} terminator: the string to use to terminate the declaration
  • {Array<int>} colonOffsets: An array of 2 integers, holding the start and end locations of the ":" that separates the property name from the value.
  • {Array<int>} offset: An array of 2 integers, which are the index in the input string at which the declaration starts and ends (so calling substring on the input will give us the authored property)
  • {Array<int>} commentOffsets: If the declaration appears in a comment, an array of 2 integers which will hold the offsets of the start and end of the enclosing comment input will give us the authored property)
  • {bool} isNameValid: true if the property is valid
  • {bool} isValid: Is the whole declaration valid

One thing that we didn't decide on yet is if we want to also get the "nested rules declarations", so we could maybe display them as well in the rule view for easier authoring (see Bug 1838179)

Flags: needinfo?(emilio)
See Also: → 1410184

Now that Bug 1410184 is fixed, I'm not sure this will give us a significant performance improvement in comparison to the augmented complexity this will requires to maintain (at least from us).
I'm closing this bug, and we can re-assess the situation if we get report of parseDeclarationsInternal being slow.

Status: NEW → RESOLVED
Closed: 5 months ago
Flags: needinfo?(emilio)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.