Closed
Bug 239079
Opened 21 years ago
Closed 21 years ago
ID tokens starting with digit allowed by CSS scanner
Categories
(Core :: CSS Parsing and Computation, defect, P2)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha1
People
(Reporter: edumerco, Assigned: bzbarsky)
References
()
Details
Attachments
(1 file, 2 obsolete files)
6.30 KB,
patch
|
chofmann
:
approval1.7+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031007 Firebird/0.7
div.600 {
width: 600px;
}
Doesn't render in 600px wide.
div#600 {
width: 600px;
}
Works OK.
Reproducible: Always
Steps to Reproduce:
1. Create an HTML document with a <div class="600">.
2. Link to it a stylesheet with the selector/prop: div.600 {width: 600px; }
3. Watch the page. The div flows normally, and it is not 600px wide.
4. Change the <div class="600"> to <div id="600">.
5. Watch the page. Now the div in the document is 600 px wide.
Actual Results:
The div in the document is 600 px wide, asi it should be.
Expected Results:
Render the div block with 600 px width from the first attempt (with the CLASS
selector).
No crash.
Comment 1•21 years ago
|
||
A class or ID starting with a digit is invalid.
http://www.w3.org/TR/2004/CR-CSS21-20040225/syndata.html#q6
You're probably writing a quirks-mode document where breaking that rule is
allowed for backwards compatibility. Probably quirks mode allows it in IDs but
not classes.
A testcase or URL showing this problem would help.
![]() |
Assignee | |
Comment 2•21 years ago
|
||
Actually, this is a problem in both modes. The code at
http://lxr.mozilla.org/seamonkey/source/content/html/style/src/nsCSSScanner.cpp#485
doesn't check that the first char of the putative ID is a StartsIdent().
It probably should, but deferring to David on this one, since syntax is his thing...
Assignee: nobody → dbaron
Status: UNCONFIRMED → NEW
Component: Layout: Block and Inline → Style System (CSS)
Ever confirmed: true
QA Contact: core.layout.block-and-inline → ian
Summary: ignores width properties with CLASS selector, works OK with ID selector → ID tokens starting with digit allowed by CSS scanner
![]() |
Assignee | |
Updated•21 years ago
|
![]() |
Assignee | |
Comment 3•21 years ago
|
||
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #145301 -
Flags: superreview?(dbaron)
Attachment #145301 -
Flags: review?(dbaron)
Comment on attachment 145301 [details] [diff] [review]
So like this, I guess
No, it should still tokenize as ID (which should probably be HASH), it should
shouldn't parse as an ID selector.
Doesn't this patch break colors?
Attachment #145301 -
Flags: superreview?(dbaron)
Attachment #145301 -
Flags: superreview-
Attachment #145301 -
Flags: review?(dbaron)
Attachment #145301 -
Flags: review-
![]() |
Assignee | |
Comment 5•21 years ago
|
||
Er, yes. Thinko... yes, a better name would help. ;)
Taking.
Assignee: dbaron → bzbarsky
OS: Windows 98 → All
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla1.8alpha
![]() |
Assignee | |
Comment 6•21 years ago
|
||
![]() |
Assignee | |
Comment 7•21 years ago
|
||
Comment on attachment 145304 [details] [diff] [review]
So more like this....
I preferred this approach to duplicating the logic in nsCSSParser, but I could
do that too, I guess.
Attachment #145304 -
Flags: superreview?
Attachment #145304 -
Flags: review?
![]() |
Assignee | |
Comment 8•21 years ago
|
||
Comment on attachment 145304 [details] [diff] [review]
So more like this....
One other option is to make the scanner produce either HASH or ID tokens
depending on whether the thing following '#' is an ident and then change color
parsing to work with both token types while leaving id parsing to only work
with the ID token.
Comment 9•21 years ago
|
||
(While you're at it should we remove IS_LATIN1? It doesn't seem to ever be used,
and it seems useless... Then again, what would I know!)
![]() |
Assignee | |
Comment 10•21 years ago
|
||
Yeah, that can probably go.
![]() |
Assignee | |
Comment 11•21 years ago
|
||
Comment on attachment 145304 [details] [diff] [review]
So more like this....
I totally failed to set those flags right... David, see comment 8
Attachment #145304 -
Flags: superreview?(dbaron)
Attachment #145304 -
Flags: superreview?
Attachment #145304 -
Flags: review?(dbaron)
Attachment #145304 -
Flags: review?
Attachment #145304 -
Flags: superreview?(dbaron)
Attachment #145304 -
Flags: superreview+
Attachment #145304 -
Flags: review?(dbaron)
Attachment #145304 -
Flags: review+
![]() |
Assignee | |
Comment 12•21 years ago
|
||
Attachment #145301 -
Attachment is obsolete: true
Attachment #145304 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 13•21 years ago
|
||
Comment on attachment 145374 [details] [diff] [review]
Same without IS_LATIN1
Could this be approved for 1.7? This fixes a bug in our ID selector parsing in
CSS (we're allowing invalid selectors).
Attachment #145374 -
Flags: approval1.7?
Comment 14•21 years ago
|
||
Comment on attachment 145374 [details] [diff] [review]
Same without IS_LATIN1
a=chofmann for 1.7
Attachment #145374 -
Flags: approval1.7? → approval1.7+
![]() |
Assignee | |
Comment 15•21 years ago
|
||
Checked in, though I had to check in a DEBUG bustage fix as well as a Windows
one (can't init static members at the declaration point in MSVC).
Note that the fix is that now ID and class selectors act identically and do NOT
apply the styles (as class selectors already did).
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 16•21 years ago
|
||
*** Bug 256684 has been marked as a duplicate of this bug. ***
This fix is actually incorrect; it should have happened before character escape
processing, not after. See bug 299148.
You need to log in
before you can comment on or make changes to this bug.
Description
•