Example 1
<ul>
<ul>
<li>
Regular text
<span style="color:brown;">
<li>
NO COLORING, but should be?</span>
</ul>
</ul>
<ul>
<ul>
<li>
Regular text
<li>
<span style="color:brown;">COLORING</span>
</ul>
</ul>
<ul>
<ul>
<li>
<span style="color:brown;">COLORING</span>
</ul>
</ul>
<span style="color:brown;">
<ul>
<ul>
<li>
COLORING
</ul>
</ul>
</span>
Example 2
<ul>
<ul>
<li>
Regular text
<span style="background-color:brown;">
<li>
NO Background COLORING, but should be?</span>
</ul>
</ul>
<ul>
<ul>
<li>
Regular text
<li>
<span style="background-color:brown;">Background COLORING</span>
</ul>
</ul>
<ul>
<ul>
<li>
<span style="background-color:brown;">Background COLORING</span>
</ul>
</ul>
<span style="background-color:brown;">
<ul>
<ul>
<li>
NO Background COLORING, but should be?
</ul>
</ul>
</span>
Thanks.
Victor.
Your code is invalid. Validate it, fix the errors, make sure you have a
DOCTYPE that triggers standards mode, then try again.
That is utterly pointless. The *entire point* of the question is whether we
should be displaying the invalid code differently than we are.
Please, please don't respond with that answer, *ever*.
--
dolphinling
<http://dolphinling.net/>
In this case, the <span> is a child of the first <li>. The first <li> doesn't
get closed until the second one is opened. Since the <span> is a child of the
first <li>, it gets automatically closed when the first one does. There's no
open <span> where the text is, so it's not colored.
Note that the </span> basically does nothing in this context, since there are no
open <span>s.
There's very, very little chance of this behavior being changed: it's needed for
other sites to operate correctly, and I believe (though I didn't check) that
HTML 5 will define it to be correct. (HTML 4 didn't define how invalid code
should be parsed.)
> <ul>
> <ul>
> <li>
> Regular text
> <li>
> <span style="color:brown;">COLORING</span>
> </ul>
> </ul>
In this case, the <span> is inside the second <li>, so there's no ambiguity at
all. (In fact, this code is valid.)
> <ul>
> <ul>
> <li>
> <span style="color:brown;">COLORING</span>
> </ul>
> </ul>
Same as above.
> <span style="color:brown;">
> <ul>
> <ul>
> <li>
> COLORING
> </ul>
> </ul>
> </span>
This case demonstrates <span>'s special handling in the parser. According to the
spec, it's an inline element and can only contain other inline content, but for
compatibility with the real world, we have to ignore that.
What happens here is that there's nothing that closes the <span>, so it's not
closed until it gets to the </span> at the end. The first <ul> is a child of the
<span>, the second <ul> is a child of the first, and so on.
> Example 2
>
> <ul>
> <ul>
> <li>
> Regular text
> <span style="background-color:brown;">
> <li>
> NO Background COLORING, but should be?</span>
> </ul>
> </ul>
This is exactly identical to the first case of example 1.
> <ul>
> <ul>
> <li>
> Regular text
> <li>
> <span style="background-color:brown;">Background COLORING</span>
> </ul>
> </ul>
>
> <ul>
> <ul>
> <li>
> <span style="background-color:brown;">Background COLORING</span>
> </ul>
> </ul>
These are identical to the second and third cases of example 1, respectively.
> <span style="background-color:brown;">
> <ul>
> <ul>
> <li>
> NO Background COLORING, but should be?
> </ul>
> </ul>
> </span>
This looks like it might a bug. It should be equivalent to the 4th case of
example 1, and I don't see why it's not.
Someone who's more familiar with the internals of Mozilla than me would have to
comment; it may have been written that way intentionally for reasons I don't know.
--
dolphinling
<http://dolphinling.net/>
The standards specify what browsers should do with valid code. They do
not specify what to do with invalid code, so if your code is invalid,
you are at the mercy of how a particular version of a particular browser
handles your errors.
You may not like my answer. Fine. But perhaps someone who is also
having problems making his code work properly with several browsers may
learn from my answer. As for you, you are a lost cause.
Thanks.
Victor.
Yes. I know that and you know that, but when the question is "Is this a bug?",
it's *not a useful answer*. The only useful answer is "yes" or "no", coupled
with an explanation of *why*.
The same is true but even more so in bugzilla. Remember, over 99% of web pages
are invalid. As a real-world web browser, we have to still display them in a
useful way. It's possible for us to have a bug even in a case where the spec
doesn't tell us what to do, and throwing out bugs because the page is invalid
can lead to us missing bugs.
Note that it's perfectly acceptable to say, *after* you've explained why it is
or isn't a bug, something like "If you're the author of this page and want to
make sure it works properly in all browsers, you might want to try making sure
your code is valid." Being helpful to the author is fine; throwing out bugs
without valid reasoning is not.
--
dolphinling
<http://dolphinling.net/>
It'll be hard to answer that without knowing more about the way your system
works. It may be easier to ask in a group dedicated to that system, if there is
one, or if not you can try asking here with more information, and someone may be
able to help you.
--
dolphinling
<http://dolphinling.net/>