These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:20 pm Advanced search

DOCTYPES: what does and what doesn't trigger quirksmode

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

DOCTYPES: what does and what doesn't trigger quirksmode

Postby Dean » Mon Mar 12, 2007 10:43 am

Hi guys, just looking for some info on doctypes for the (x)html5 spec.
I'm familiar with the:
Code: Select all
<!DOCTYPE html>

but I'd like to know what else you can do with this while still having the user-agent render the document in standards mode on a large range of browsers as is seen on: http://hsivonen.iki.fi/doctype/
For example, what happens if you use one of these below.

[1]
Code: Select all
<!DOCTYPE html5>

[2]
Code: Select all
<!DOCTYPE html 5>

[3]
Code: Select all
<!DOCTYPE xhtml5>

[4]
Code: Select all
<!DOCTYPE html foo>

[5]
Code: Select all
<!DOCTYPE html foo/bar/baz>


I read on Anne's blog http://annevankesteren.nl/2005/07/html5-doctype [1] about Firefox going into quirksmode presumably from the 5 at the end. But what about [2] where there is a space, is this ok? And [5], would this work?

I'd be interested to know what results people have obtained through any testing with similar DOCTYPES. I'd also like to know what people think about the DOCTYPE being case sensitive, I think it should be.

Cheers Dean
Dean
<h6>
 
Posts: 2
Joined: Sat Mar 10, 2007 1:06 pm
Location: Auckland, New Zealand

Re: DOCTYPES: what does and what doesn't trigger quirksmode

Postby hasather » Mon Mar 12, 2007 2:24 pm

Hi Dean.
Dean wrote:Hi guys, just looking for some info on doctypes for the (x)html5 spec.
I'm familiar with the:
Code: Select all
<!DOCTYPE html>

but I'd like to know what else you can do with this while still having the user-agent render the document in standards mode on a large range of browsers as is seen on: http://hsivonen.iki.fi/doctype/

Why do you want to know that?
For example, what happens if you use one of these below.
[...]

I don't know what happens really. Presumably, most of them will make the document render in quirks mode.
I read on Anne's blog http://annevankesteren.nl/2005/07/html5-doctype [1] about Firefox going into quirksmode presumably from the 5 at the end. But what about [2] where there is a space, is this ok?
No, as it's not correct according to the specification.
And [5], would this work?
In what sense? It might throw some user-agent into standards mode, I don't know, but it's not right according to the specification so that doesn't matter.
I'd also like to know what people think about the DOCTYPE being case sensitive, I think it should be.
I don't think it should, why do you think that?
hasather
<h6>
 
Posts: 5
Joined: Tue Feb 06, 2007 8:28 pm

Postby zcorpan » Mon Mar 12, 2007 4:29 pm

All will trigger quirks mode in at least Gecko and WebKit.
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby Dean » Tue Mar 13, 2007 3:43 am

Thanks Simon, thought you would know :)

Dean
Dean
<h6>
 
Posts: 2
Joined: Sat Mar 10, 2007 1:06 pm
Location: Auckland, New Zealand

Postby wgabrie » Sat Apr 07, 2007 11:54 pm

The HTML 5.0 Doctype:
Code: Select all
<!DOCTYPE HTML>


What is missing from the HTML 5.0 doctype:
1. PUBLIC keyword
2. DTD FPI (Formal Public Identifier)
3. DTD url

I found the DTD file for the HTML 5.0 Draft. <http://syntax.whatwg.org/sgml/html5core+wf2/pre1/dtd> After reading it, This is how I think the doctype could be written:

Code: Select all
<!DOCTYPE HTML PUBLIC "-//WHATWG//DTD HTML 5.0 Core + Web Forms 2.0//EN"
"http://syntax.whatwg.org/sgml/html5core+wf2/pre1/dtd">
wgabrie
<h4>
 
Posts: 25
Joined: Thu Apr 05, 2007 8:55 pm

Postby zcorpan » Sun Apr 08, 2007 7:59 am

wgabrie wrote:The HTML 5.0 Doctype:
Code: Select all
<!DOCTYPE HTML>


What is missing from the HTML 5.0 doctype:
1. PUBLIC keyword
2. DTD FPI (Formal Public Identifier)
3. DTD url
HTML5 is not SGML, and even if it were the FPI and SI are both optional. In XHTML5 you can use whichever doctype you want, or preferably none at all.
wgabrie wrote:I found the DTD file for the HTML 5.0 Draft.
It's not normative. It's obsolete and should really return a 410 Gone by now. :)
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby anne » Mon Apr 09, 2007 3:04 pm

That DTD is just there for people who like DTDs. Nothing more. (I don't think it should be removed.)
User avatar
anne
<h4>
 
Posts: 32
Joined: Tue Feb 06, 2007 11:17 pm
Location: Utrecht, NL

Postby wgabrie » Tue Apr 10, 2007 1:42 am

The WHATWG FAQ says a Doctype triggers "standards mode" in browsers. I studied Doctypes (it wasn't fun). W3.org's xhtml doctypes all begin with "DOCTYPE HTML." It seems <!DOCTYPE HTML> is "safe." When I type more it is usually rendered in "quirks mode" unless I complete the dtd information.

Why do the doctypes in post 1 trigger quirks mode?
Is it because "html5" and "foo" aren't valid document types?
Why is this code "safe" until we type more?
What does a DTD do anyway?
wgabrie
<h4>
 
Posts: 25
Joined: Thu Apr 05, 2007 8:55 pm

Postby zcorpan » Tue Apr 10, 2007 7:46 am

wgabrie wrote:Why do the doctypes in post 1 trigger quirks mode?
They are not correct doctype declarations per SGML, and so Gecko's implementation considered them quirky.
wgabrie wrote:What does a DTD do anyway?
A doctype declaration, in SGML and XML, is a reference to a DTD, or it can contain DTD declarations in the internal subset. These declarations tells an SGML parser how to parse the document. DTDs also have infoset augmentation and inclusion features. You can also validate the document against its DTD to see if it conforms to the rules it declares itself. Dispite common belief, it does not tell what type of document it is.

XML 1.0 was designed to support DTDless parsing, but didn't drop DTDs, presumably because backwards compatibility with SGML was also a design goal.

Namespaces in XML came after XML 1.0, and is layered on top of DTD processing, and so DTDs don't actually support namespaces. Instead of trying to fix XML DTDs new better schema languages were developed, in particular XML Schema and RELAX NG.

In HTML, if we stop pretending that it is SGML, a doctype declaration is merely a switch between different rendering modes in browsers, and conformance checkers can look at it to decide what type of document to check conformance against (unless the person validating chose what to check against).
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden

Postby mrLenin » Tue Apr 10, 2007 2:35 pm

HTML5 Doctype is Unrecognized Or, When a Document Type Declaration is not a DTD.

Web Applications 1.0 HTML5 offers a simple Document Type Declaration for triggering standards-complaint mode.

<!DOCTYPE html>

Elegance in simplicity.

The following article constructs an explanation of how this sleight-of-hand’s achieved.
mrLenin
<h6>
 
Posts: 1
Joined: Thu Mar 29, 2007 11:58 am

Postby Scott » Sun Jul 12, 2009 10:02 am

For those curious about doctypes, this is the best article Ive found explaining them and their purpose:

http://www.resultswebdesign.com.au/web-design/technical/doctypes/
Scott
<h6>
 
Posts: 1
Joined: Sun Jul 12, 2009 9:59 am
Location: Brisbane, Australia


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest