Closed Bug 69032 Opened 24 years ago Closed 22 years ago

XHTML whitespace rules aren't being followed

Categories

(Core :: XML, defect)

defect
Not set
minor

Tracking

()

RESOLVED INVALID
Future

People

(Reporter: decoy, Assigned: hjtoi-bugzilla)

Details

(Keywords: xhtml, Whiteboard: INVALID/WONTFIX)

Attachments

(2 files)

On the page cited, there are red xhtml:pre elements. It is easy to see that the initial linefeed after the <pre>-tag gets rendered as a blank line, unlike when the XHTML documents are served as text/html. So it's not an HTML or XML problem, but an XHTML one. According to the XHTML spec (http://www.w3.org/TR/xhtml1/#uaconf ): "[...] The following characters are defined in [XML] as whitespace characters: [...] Carriage return (&#x000D;) Line feed (&#x000A;) [...] In elements where the 'xml:space' attribute is set to 'preserve', the user agent must leave all whitespace characters intact (with the exception of leading and trailing whitespace characters, which should be removed). [...] Leading and trailing whitespace inside a block element must be removed. [...]". I.e. <pre> should work as in HTML. Marking as enhancement since XHTML is a christmas-list item...
jg@cyberstorm:~$ host upsws3591.ntc.nokia.com upsws3591.ntc.nokia.com A record currently not present Reporter: can you attach a testcase please? Severity should be Normal. This could be parser or layout.
Severity: enhancement → normal
Damn. Changed the URL to an online version. I must be braindead, or getting senile. It's much more likely that it's a layout thing - if it was the XML parser, people would have noticed it elsewhere.
Confirmed Platform: PC OS: Linux 2.2.16 Mozilla Build: 2001021408 Marking NEW.
Severity: normal → minor
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows NT → All
Hardware: PC → All
qa contact updated.
QA Contact: gerardok → bsharma
changing the component to 'Layout'.
Assignee: clayton → karnaze
Component: HTML Element → Layout
QA Contact: bsharma → petersen
Target Milestone: --- → mozilla0.8.1
Reassigning to Buster's list.
Assignee: karnaze → buster
Target Milestone: mozilla0.8.1 → mozilla1.0
Adding keyword.
Keywords: xhtml
Reporter: the URL no longer contains the tags in question. Do you have another URL showing the problem? Is this related to bug 2750?
Ah, yes. They are green now. What a wonderful choice of colors, don't you think? ;) It's <pre class="disposition"> in the code, and the leading empty line still seems to be there at 0.9.3.
Build reassigning Buster's bugs to Marc.
Assignee: buster → attinasi
Target Milestone: mozilla1.0 → mozilla1.2
Having done investigation into Bug 2750, there's code in the htmlparser to handle this specific situation for HTML. Probably an XML parser problem and not layout. Can you provide a new testcase?
Assignee: attinasi → heikki
Component: Layout → XML
Seems like the testcase is no longer available. It would help if someone made a testcase and attached it to this bug, so it wouldn't get lost. I think we have never supported xml:space, so I don't think this is XHTML specific. I would bet it is an issue with Expat or possibly with our integration of it. There might be a dupe about this somewhere.
Pre element in XHTML, which shouldn't have a leading empty line
Attached a test case. I think the problem is that, XML parsers are supposed to return all white-space to the application. Regardless of xml:space, even, if I'm not entirely mistaken. This is different from HTML, where the parser is supposed to have removed the space. So, in XHTML the parser *will* give us the extra linefeed in the beginning of <pre/>, and the content sink will have to know to strip it.
Target Milestone: mozilla1.2alpha → Future
The XHTML spec has _no_ business telling us what to do when parsing. This is invalid, IMHO. We are rendering the test case correctly.
QA Contact: petersen → ian
Whiteboard: INVALID/WONTFIX
I can't see that the XHTML spec says anything like comment 0 (was it quoting a workdraft?). AFAICT this bug is INVALID
It says it in: http://www.w3.org/TR/xhtml1/#uaconf But I still think that's ridiculous and can be ignored.
The orignal test case with a genuine XHTML MIME type. Attached to test for XML/XHTML variance in whitespace handling.
Let me clarify. According to XHTML 1.0 and HTML 4.0(1) (the two of which I was originally referring to), the attached test cases should render without a leading empty line. I suspect later XHTML versions will tell you the same thing, although I haven't checked. The problem arises because XHTML is an XML application, while HTML is an SGML or standalone one, as I've explained. I agree that whatever the Mozilla HTML and XML parsers actually do, internally, is none of W3C standards' business. Still, rendered text should work according to the rules as a whole. As of the latest nightly build (2002120208) it doesn't. For it to pass, the conditions are: -If you parse the example as XML (text/xml), the leading whitespace should render if you do not switch to XHTML rendering upon encountering the XHTML namespace. -If you parse the example as XML (text/xml), the leading whitespace shouldn't render if you switch to XHTML rendering upon encountering the XHTML namespace. -If you parse it as XHTML (application/xhtml+xml) the leading whitespace most definitely shouldn't show. -If you parse the corresponding SGML/HTML representation (text/html), the leading whitespace would obviously be discarded. At the moment, neither of the attached representations works as it's supposed to. The first one is supposed to be rendered as XML, so we could argue Mozilla parses it as XML without paying regard to namespaces, and so fails to notice that pre-elements should be handled differently (as per XHTML 1.0). The newly attached one with the XHTML MIME type however is incorrectly rendered by any definition. Hence, Mozilla isn't conformant to XHTML 1.0. I originally marked this as an enhancement, since XHTML isn't part of the current, official Mozilla agenda. Thus, it doesn't bother me if the Mozilla crowd decides that XHTML isn't worth supporting -- I do understand about priorities. But this one definitely isn't INVALID. It's either WONTFIX or NEW; minor, major or enhancement.
The point is, we're not an XHTML user agent. We're an XML+CSS user agent that happens to have some knowledge about the XHTML namespace. So those rules don't apply to us.
In that case, the report should probably once more be marked enhancement and resolved WONTFIX.
Any particular reason why this one isn't RESOLVED (WONTFIX or INVALID)?
why indeed
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: