Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18731

Re: Effect of a HTML5 doctype

From "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Newsgroups comp.lang.javascript
Subject Re: Effect of a HTML5 doctype
Date 2013-03-06 08:08 +0200
Organization A noiseless patient Spider
Message-ID <kh6me3$hvb$1@dont-email.me> (permalink)
References <L5KdnQzeBeIiNavMnZ2dnUVZ_q-dnZ2d@westnet.com.au>

Show all headers | View raw


2013-03-06 4:23, Andrew Poulos wrote:

> A company I consult to uses an elearning tool from a large US firm. The
> tool has been recently updated and one of its "new" features is that it
> publishes to HTML5.

If that's what they say, consider it normal marketese: it's not true, 
but it may mean *something*, so caution is needed.

> When I look at the source of the pages it published
> to HTML5 I see stuff like
[...]
> As far as I can tell their HTML5 compliance means that they've changed
> the doctype (and nothing else.)

That does not imply HTML5 compliance of course. In fact, HTML5 does not 
even require <!DOCTYPE html>: it specifies some old doctype strings as " 
obsolete permitted DOCTYPEs", which are conforming, but not recommended.

But a document that is valid HTML 4.01 *may* be valid HTML5 too (and 
changing the doctype string would not change this of course). Your code 
snippet, when closed the obvious way with --></script>, is in fact valid 
HTML5 except for the attribute "text" in <style>, which is not valid in 
any version of HTML.

> My question is, what effect does changing a doctype, and HTML that uses
> obsolete features have on any js that's in the page?

The only effect on browsers is in the doctype sniffing process, and 
normally <!DOCTYPE html> does the same as a doctype declaration that 
conforms to HTML 3.01: it triggers "standard mode". There are some 
deviations from this, but they can probably be classified as historical 
(like things that happen on Netscape). I haven't seen a more up-to-date 
summary of this than at
http://hsivonen.iki.fi/doctype/

If a page previously had no doctype or had a doctype that triggers 
"quirks mode", then the impact on interpretation of CSS and, to some 
extent, of HTML can be drastic (or none, or something between), see
http://www.cs.tut.fi/~jkorpela/quirks-mode.html
As far as I know, the only directly JavaScript-related effect of 
standards/quirks mode is this:

The so-called named access on the Window object such as using (in 
JavaScript) window.foo, window['foo'] or just foo to refer to the 
element with id="foo" is possible in Quirks Mode only in some versions 
of Firefox. (In version 15, it however restored support to this legacy 
feature in both modes.)

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

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Effect of a HTML5 doctype Andrew Poulos <ap_prog@hotmail.com> - 2013-03-06 13:23 +1100
  Re: Effect of a HTML5 doctype "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2013-03-06 08:08 +0200

csiph-web