Closed
Bug 943200
Opened 11 years ago
Closed 11 years ago
`content: "!"` is marked as invalid and is not applied
Categories
(DevTools :: Inspector, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: julienw, Unassigned)
References
Details
Attachments
(1 file)
187 bytes,
text/html
|
Details |
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.
Comment 1•11 years ago
|
||
I think that you forgot to attach the file.
Comment 2•11 years ago
|
||
(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.
Reporter | ||
Comment 3•11 years ago
|
||
Comment 4•11 years ago
|
||
Would be great if someone could look into this. I think it's an easy fix.
Comment 5•11 years ago
|
||
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.
Comment 6•11 years ago
|
||
The same problem will therefore occur with ! in URLs:
background: url(http://somesite.com?param=!);
Comment 7•11 years ago
|
||
I think just removing the empty space before (important) should do it, I don't understand why it's there.
Comment 8•11 years ago
|
||
(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).
Comment 9•11 years ago
|
||
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
Reporter | ||
Comment 10•11 years ago
|
||
Verified too, thanks !
Comment 11•11 years ago
|
||
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).
Updated•7 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•