From: Jukka K. Korpela on
GTalbot wrote:

> On 29 mai, 10:43, Osmo Saarikumpu <o...(a)wippies.com> wrote:
>
>> Yep, at least my IE8 messes up in many ways in all modes. It even
>> applies td[colspan] to every td.
>
> Actually, this is not a bug in IE8 since colspan attribute is
> specified with a default value (of 1) in the DTD. If the user agent
> reads the DTD, then it has to match td[colspan] to every td.
>
> 5.8.2 Default attribute values in DTDs
> http://www.w3.org/TR/CSS21/selector.html#default-attrs

I have tried to read that passage, and its predecessors, in different ways,
and I still don't see what they are trying to say.

The question is simple: does a selector of the form x[y] match an <x>
element that lacks the y attribute but has a default value declared for that
attribute, in a DTD?

If the answer is "yes", then a selector like td[colspan] is equivalent to td
except for specificity, and hence rather useless.

A selector like input[type] would be equally useless, an unnecessary
complication, whereas, under this interpretation, input[type="text"] would
be useful as it would match exactly those input elements that represent
single-line text input fields.

Yet, the CSS 2.1 draft says that a browser is not required to read an
"external subset" of the DTD, which means for all practical purposes that it
need not know anything about any default values set in a DTD. Hence,
input[type="text"] would be worse than useless since it would not work on
present-day browsers (which don't do DTDs).

In fact, the example in this part of the CSS 2.1 draft suggests that all
this thing about default values set in DTDs was just idle talk. It says,
without any "if" or "may" here, that the selector EXAMPLE[notation=decimal]
"will not match elements whose 'notation' attribute is set by default, i.e.,
not set explicitly".

This is about CSS, not HTML, so I'm moving the discussion to
c.i.w.a.stylesheets.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

From: Thomas 'PointedEars' Lahn on
Jukka K. Korpela wrote:

> GTalbot wrote:
>> On 29 mai, 10:43, Osmo Saarikumpu <o...(a)wippies.com> wrote:
>>> Yep, at least my IE8 messes up in many ways in all modes. It even
>>> applies td[colspan] to every td.
>>
>> Actually, this is not a bug in IE8 since colspan attribute is
>> specified with a default value (of 1) in the DTD. If the user agent
>> reads the DTD, then it has to match td[colspan] to every td.
>>
>> 5.8.2 Default attribute values in DTDs
>> http://www.w3.org/TR/CSS21/selector.html#default-attrs
>
> I have tried to read that passage, and its predecessors, in different
> ways, and I still don't see what they are trying to say.

AIUI:

> The question is simple: does a selector of the form x[y] match an <x>
> element that lacks the y attribute but has a default value declared for
> that attribute, in a DTD?
^^^^^^^^
Answer: It may, but don't count on that it does. A DTD is considered to
define the "external subset" and

| [...] a UA is not required to read an "external subset" of the DTD [...]
|
| Note that, typically, implementations choose to ignore external subsets.

> If the answer is "yes", then a selector like td[colspan] is equivalent to
> td except for specificity, and hence rather useless.

That is logical. But since the answer is basically "No", `td[colspan]' is
not equivalent to `td':

td[colspan] {
...
}

would *not need to* select

<td>...</td>

except when you have also the following internal subset declared:

<!DOCTYPE ... [
<!ATTLIST td
colspan CDATA "foo"
>
]>

| [...] a UA [...] is required to look for default attribute values in the
| document's "internal subset." (See [XML10] for definitions of these
| subsets.)

So what we have here is IE 8 somehow considering the external subset. Since
a UA is not forbidden to do that, it is _not_ a bug in MSHTML 8. But the
used selector goes against the Recommendation, so it should not come as a
surprise that using it causes the not interoperable behavior described there
(i.e., "non-IE" may not consider the external subset and the selector would
not match).

> In fact, the example in this part of the CSS 2.1 draft suggests that all
> this thing about default values set in DTDs was just idle talk.
> It says, without any "if" or "may" here, that the selector
> EXAMPLE[notation=decimal] "will not match elements whose 'notation'
> attribute is set by default, i.e., not set explicitly".

I don't think so.


HTH

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:160