This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27860 - unordered lists with invalid list-style-type should not render as ordered lists
Summary: unordered lists with invalid list-style-type should not render as ordered lists
Status: RESOLVED MOVED
Alias: None
Product: CSS
Classification: Unclassified
Component: Lists and Counters (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Tab Atkins Jr.
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-19 17:58 UTC by Tom Robinson
Modified: 2019-02-11 11:30 UTC (History)
1 user (show)

See Also:


Attachments
unordered lists rendered in 6 browsers shows problem in Firefox (16.03 KB, image/png)
2015-01-19 17:58 UTC, Tom Robinson
Details

Description Tom Robinson 2015-01-19 17:58:31 UTC
Created attachment 1564 [details]
unordered lists rendered in 6 browsers shows problem in Firefox

The initial values for list-style-type are:

    ol { list-style-type: decimal; }
    ul { list-style-type: disc; }

For nested lists it gets more complicated, but my concern is about a very simple case that is common on many legacy websites.

There are many websites with <ul style="list-style-type:bullet"> or "disk" etc. In the past, the result looked fine because these invalid values were ignored, and reverted to the default of "disc".

Recently, Firefox is "breaking" these sites by falling back to "decimal", and rendering such unordered lists are as ordered lists. The developers justify this by referring to the current CSS3 spec, which states that an invalid list-style-type should default to "decimal".

Could the CSS spec wording be changed to state that the fallback should be "decimal" for ordered lists and "disc" for unordered lists?
Comment 1 Tab Atkins Jr. 2015-01-20 20:53:16 UTC
Unfortunately, this problem is unavoidable with current properties.

Previously, when the set of counter-styles was defined by the language, we could tell at parse time whether the value was valid or not, and reject the declaration if it was invalid.  That gave you the older behavior, of still using bullets or numbers, as it could fall back to the UA stylesheet.

With the introduction of @counter-style, though, we can't do that any longer.  The set of valid counter style names isn't known at parse-time, as it depends on other rules in the stylesheet (or in other stylesheets, perhaps from different domains).  Thus, we can't reject an unknown value at parse time and fall back any longer.

If we can't fall back, then there needs to be *some* defined behavior for what to do when, at run-time, we find out the counter-style name is invalid.  For lack of a better option, and for consistency with a few other bits, I chose to default it to "decimal".  We can't change fallback for "ordered" or "unordered" lists, because that information doesn't exist for CSS.  At best, we have tagnames, which is a hacky HTML-specific solution that doesn't work well.

There is, potentially, a way around this - we could add an additional property defining whether something is semantically an ordered or unordered list.  Its sole purpose would be to have the UA stylesheet set it on <ol> and <ul>, and then have the "what to do if the name is invalid" algorithm look at it to tell whether to default to bullets or numbers.  I'll start a thread on www-style about this.
Comment 2 Fuqiao Xue 2019-02-11 11:30:15 UTC
Moved to Github issue: https://github.com/w3c/csswg-drafts/issues/3563