[whatwg] Warnings for non-applicable properties
Paul Arzul
paul.arzul at gmail.com
Sun Nov 9 22:53:31 PST 2008
(whatwg, please see last bit.)
2008/11/9 Jukka K. Korpela <jkorpela at cs.tut.fi>:
> Benjamin Hawkes-Lewis wrote:
>
>> Paul Arzul wrote:
>>>
>>> CSS defines when properties are applicable (see the Applies column:
>>> <http://www.w3.org/TR/CSS21/propidx.html>)
>>>
>>> Should we generate warnings when properties are not applicable? For
>>> example: p
>>> {
>>> border-collapse : collapse;
>>> }
>>>
>>> We could warn about the paragraph not being a table or inline-table
>>> element. (I get no warnings with Warnings set to All.)
>>
>> That would only be reliable if one could assume default CSS for HTML
>> and that p was an HTML element rather than an element in some random
>> XML dialect - but you can't assume either from the raw CSS.
i thought you could with css namespaces: http://www.w3.org/TR/css3-namespace/
please don't loose sight of the most common use case - an html file
with some css. are the css validator's web logs public? what do they
have to say? i'd love to know:
* how much css is validated off non-xhtml xml and how much is (x)html?
* how much traction css namespaces are getting
> Even in that case, the assumptions might fail because the document has
> intentionally been written or styled against your expectations.
i wasn't making assumptions. i was expecting the validator to check
against a running total (computed) value and not a static list which
is but a starting point for default values.
> But you _could_ issue warnings that are solely based on applicability
> statements made within CSS specs. For example, you could check whether the
> display property has the value table and if not, issue a non-applicability
> warning about border-collapse. Of course this means that you would need to
> include some assumed default browser style sheet, so that you know (or think
> you know) the default values for the display property of different elements,
> for example.
we could use the "Default style sheet for HTML 4":
http://www.w3.org/TR/CSS21/sample.html
some research against common browsers's user agent stylesheets should
be done to check for any serious discrepancies.
> Besides, you cannot really know the properties of an element by analyzing
> one style sheet only, even if you assume that the document is HTML. Any
> other style sheet (that will be used when rendering the document, along with
> the style sheet being analyzed) might assign display: table, making
> border-collapse applicable.
(i suggested a warning, not an error.) as always the cascade applies,
but it is still useful to know that a single css file is generating
warnings since someone else might decide to include it without
following your imports. we could also recommend validating from the
root/base html or css due to cascade implications.
>> The validator could include additional UI (e.g. checkboxes to indicate
>> that this CSS if for HTML and the valiator should assume the suggested
>> default CSS from CSS 2.1) that would mitigate those problems.
>
> I have no specific objections, but who is going to define what is and what
> is not applicable to different elements then?
is it unfortunate that the html4 stylesheet is only informative?
perhaps html5 could then consider giving us a normative default user
agent stylesheet - or at least a normative version with only display
properties.
- p
More information about the whatwg
mailing list