Closed Bug 1030114 Opened 10 years ago Closed 10 years ago

new API in inIDOMUtils to check whether a property accepts a color as its value

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1006595

People

(Reporter: pbro, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

In the devtools' inspector, we currently parse the CSS properties applied to the currently inspected element so as to provide more information and tools to understand it and modify it. One example of which is the circular color swatches that we add right before every color values in the inspector's CSS rule view (see screenshot). In order to get these color swatches in place, we need to parse the values and look for colors. We currently have a problem where we don't know how to differentiate real color values from free text that looks like a color value. Here are 2 properties that will trick our simple parser: font-family: Arial Black; animation-name: black; In both these cases, we will prefix "black" with a color swatch. One thing that would help us avoid these errors would be a new API in inIDOMUtils that tells us whether we can expect to find color(s) in a value, given a property name. This way we could skip things like font-family and animation-name for instance. bz mentioned: "One can abuse getCSSValuesForProperty for this (see if the color in question is in the list) but that does a lot more work than would a check for whether color is a valid value type". Obviously short-hand properties are a little bit more complex because they have composed value types.
As discussed over IRC, assigning the bug to you.
Assignee: nobody → bzbarsky
Blocks: 977063
bz: I logged bug 1006595 for the helpers that would be useful for us. You can take over that if you would like.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: