Closed Bug 943200 Opened 11 years ago Closed 11 years ago

`content: "!"` is marked as invalid and is not applied

Categories

(DevTools :: Inspector, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: julienw, Unassigned)

References

Details

Attachments

(1 file)

STR: * load the attached file in Firefox * open the inspector * inspect the div element (point the "!" character on the page) * have a look in the "Rules" subpanel Expected: * the "content" property looks good Actual: * the "content" property is shown as invalid Then: * edit the content value * don't change anything, just press enter Expected: * the property is still applied Actual: * the property is disabled, probably because it's seen as invalid. Note: this is a real bug and not a feature request.
I think that you forgot to attach the file.
(In reply to Michael Ratcliffe [:miker] [:mratcliffe] from comment #1) > I think that you forgot to attach the file. Just add a "!" in "content", you'll see it's invalid.
Would be great if someone could look into this. I think it's an easy fix.
I believe this is caused by thisregex in rule-view.js const CSS_PROP_RE = /\s*([^:\s]*)\s*:\s*(.*?)\s*(?:! (important))?;?$/; The value part is non-greedy and therefore the regex will match as few chars as possible until it finds a ! char, which it does in this case.
The same problem will therefore occur with ! in URLs: background: url(http://somesite.com?param=!);
I think just removing the empty space before (important) should do it, I don't understand why it's there.
(In reply to Patrick Brosset [:pbrosset] from comment #7) > I think just removing the empty space before (important) should do it, I > don't understand why it's there. It should be /\s*([^:\s]*)\s*:\s*(.*?)\s*(?:!\s?(important))?;?$/ because: "background-color: red ! important" "background-color: red !important" are both valid and produce: $1: background-color $2: red $3: important 'content: "!"' is also classed as valid according to this regex (! is caught by $2).
This seems to be working for me. Tested on the latest pull and build from fx-team.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Verified too, thanks !
This fix for bug 964255 fixed that issue I believe (introduced the use of a css tokenizer to parse the cssText rather than relying on regexes).
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: