[whatwg] /html with omitted tags
I can start with a simple document that's probably conforming and that the validator doesn't complain about: !DOCTYPE htmlhtmlheadtitle/title/headbody/body/html Then I can read the Writing HTML document: Optional tags section, which says: A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment. A body element's start tag may be omitted if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element. A body element's end tag may be omitted if the body element is not immediately followed by a comment. So I choose to omit the /headbody/body because I think those rules say I can do so. I get: !DOCTYPE htmlhtmlheadtitle/title/html But now I get a parse error, which I think is because the /html comes in the in head insertion mode and is Any other end tag: Parse error. Ignore the token., so something seems wrong. -- Philip Taylor exc...@gmail.com
Re: [whatwg] /html with omitted tags
Philip Taylor ha scritto: I can start with a simple document that's probably conforming and that the validator doesn't complain about: !DOCTYPE htmlhtmlheadtitle/title/headbody/body/html Then I can read the Writing HTML document: Optional tags section, which says: A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment. A body element's start tag may be omitted if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element. A body element's end tag may be omitted if the body element is not immediately followed by a comment. So I choose to omit the /headbody/body because I think those rules say I can do so. I get: !DOCTYPE htmlhtmlheadtitle/title/html But now I get a parse error, which I think is because the /html comes in the in head insertion mode and is Any other end tag: Parse error. Ignore the token., so something seems wrong. AIUI, omitting those closing tags is a parse error anyway, but in certain situations the parser can fix the code automatically because the state to enter/remain in is unambigous. Thus a validator notifies a parse error, while a browser keeps the error internally and handles it when possible. AIUI, a brower would notice the error but might ignore it since both in !DOCTYPE htmlhtmlheadtitle/title/html and in !DOCTYPE htmlhtmlheadtitle/title/headbody/body/html there is nothing to show but the background color of the html root element as provided by default style sheets (that is, they're equivalent), whereas finding a showable start tag (like a p) would lead (about) to automatic insertions of /head and body and to reconsume the tag as in body insertion mode. Indeed, section 8.1 says, /'This section only applies to documents, authoring tools, and markup generators. In particular, it does not apply to conformance checkers; conformance checkers must use the requirements given in the next section (parsing HTML documents).' ///thus section 8.1.2.4 Optional tags does not apply to validators. ;-) [ space characters and comments may be handled correctly anyway, but omitting the /head tag would result in a different document tree, thus athors and authoring tools should take care that !DOCTYPE htmlhtmlheadtitle/title!-- this is a comment --/html and !DOCTYPE htmlhtmlheadtitle/title/head!-- this is a comment --/html are not fully equivalent ] -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f Sponsor: Polizza auto? * Garanzia furto e incendio per un anno al vantaggioso prezzo di 30 euro tasse incluse! Affrettati, hai tempo fino al 31 Dicembre! * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8510d=26-12
Re: [whatwg] /html with omitted tags
On 26 Dec 2008, at 17:02, Calogero Alex Baldacchino wrote: Philip Taylor ha scritto: I can start with a simple document that's probably conforming and that the validator doesn't complain about: !DOCTYPE htmlhtmlheadtitle/title/headbody/body/ html Then I can read the Writing HTML document: Optional tags section, which says: A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment. A body element's start tag may be omitted if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element. A body element's end tag may be omitted if the body element is not immediately followed by a comment. So I choose to omit the /headbody/body because I think those rules say I can do so. I get: !DOCTYPE htmlhtmlheadtitle/title/html But now I get a parse error, which I think is because the /html comes in the in head insertion mode and is Any other end tag: Parse error. Ignore the token., so something seems wrong. AIUI, omitting those closing tags is a parse error anyway, but in certain situations the parser can fix the code automatically because the state to enter/remain in is unambigous. Thus a validator notifies a parse error, while a browser keeps the error internally and handles it when possible. The writing HTML documents section is meant to give what is a conforming HTML document, and those documents are conforming according to that. However, conformance checkers which are meant to follow the parser section (and throw the parse errors that produces) which in these cases differs. Therefore, either the writing section is wrong or the parser is wrong to throw the parse errors. -- Geoffrey Sneddon http://gsnedders.com/
Re: [whatwg] /html with omitted tags
Geoffrey Sneddon ha scritto: On 26 Dec 2008, at 17:02, Calogero Alex Baldacchino wrote: Philip Taylor ha scritto: I can start with a simple document that's probably conforming and that the validator doesn't complain about: !DOCTYPE htmlhtmlheadtitle/title/headbody/body/html Then I can read the Writing HTML document: Optional tags section, which says: A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment. A body element's start tag may be omitted if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element. A body element's end tag may be omitted if the body element is not immediately followed by a comment. So I choose to omit the /headbody/body because I think those rules say I can do so. I get: !DOCTYPE htmlhtmlheadtitle/title/html But now I get a parse error, which I think is because the /html comes in the in head insertion mode and is Any other end tag: Parse error. Ignore the token., so something seems wrong. AIUI, omitting those closing tags is a parse error anyway, but in certain situations the parser can fix the code automatically because the state to enter/remain in is unambigous. Thus a validator notifies a parse error, while a browser keeps the error internally and handles it when possible. The writing HTML documents section is meant to give what is a conforming HTML document, and those documents are conforming according to that. However, conformance checkers which are meant to follow the parser section (and throw the parse errors that produces) which in these cases differs. Therefore, either the writing section is wrong or the parser is wrong to throw the parse errors. -- Geoffrey Sneddon http://gsnedders.com/ Hmm, yeah, perhaps a /html tag should be treated as stated for the in body insertion mode also for the in head and after head (or better, it should be treated as anything else for consistence with section 8.1); this way, !DOCTYPE htmlhtmlheadtitle/title/html would be treated as !DOCTYPE htmlhtmlheadtitle/title/headbody/body/html without any parse error. Otherwise, if a document missing a body element is to be considered non-conforming, that should be stated in section 8.1.2.4 (since actually it seems to be conforming). Regards, Alex -- Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f Sponsor: Crea il tuo Webshire su Leiweb, fallo sfilare e vinci fantastici premi Locman e Coccinelle. Partecipa subito al concorso! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8515d=26-12