Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Re: Declaring as HTML 4 strict or HTML 5? (http://www.velocityreviews.com/forums/t957563-re-declaring-as-html-4-strict-or-html-5-a.html)

Tim Streater 02-12-2013 11:01 PM

Re: Declaring as HTML 4 strict or HTML 5?
 
In article <MPG.2b84e60b9c91d8b098c96a@news.supernews.com>,
Alfred Molon <alfred_molon@yahoo.com> wrote:

> Should one declare HTML pages as HTML 4 strict or HTML 5?
>
> In other words use this header
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
>
> or this one
> <!DOCTYPE html>
>
> Or is it irrelevant?
>
> I'm asking because Google (on their maps API page) seem to suggest that
> pages should be declared as HTML 5.


All that matters is that you either have a doctype or you don't. These
days, just use <!DOCTYPE html> everywhere.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689

Tim Streater 02-12-2013 11:09 PM

Re: Declaring as HTML 4 strict or HTML 5?
 
In article <MPG.2b84e91741b37e3998c96b@news.supernews.com>,
Alfred Molon <alfred_molon@yahoo.com> wrote:

> In article <timstreater-C79A22.23013512022013@news.individual.net>, Tim
> Streater says...
> > In article <MPG.2b84e60b9c91d8b098c96a@news.supernews.com>,
> > Alfred Molon wrote:
> >
> > > Should one declare HTML pages as HTML 4 strict or HTML 5?
> > >
> > > In other words use this header
> > > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > > "http://www.w3.org/TR/html4/strict.dtd">
> > >
> > > or this one
> > > <!DOCTYPE html>
> > >
> > > Or is it irrelevant?
> > >
> > > I'm asking because Google (on their maps API page) seem to suggest that
> > > pages should be declared as HTML 5.

> >
> > All that matters is that you either have a doctype or you don't. These
> > days, just use <!DOCTYPE html> everywhere.

>
> So it's irrelevant?


Well, it's irrelevant to me. Most of my DOM is generated by JavaScript.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689

Jukka K. Korpela 02-13-2013 12:23 AM

Re: Declaring as HTML 4 strict or HTML 5?
 
2013-02-13 1:05, Alfred Molon wrote:

> In article <timstreater-C79A22.23013512022013@news.individual.net>, Tim
> Streater says...
>> In article <MPG.2b84e60b9c91d8b098c96a@news.supernews.com>,
>> Alfred Molon wrote:
>>
>>> Should one declare HTML pages as HTML 4 strict or HTML 5?
>>>
>>> In other words use this header
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>>
>>> or this one
>>> <!DOCTYPE html>

[...]
>> All that matters is that you either have a doctype or you don't.


As far as browser behavior is considered, the two specific doctype
strings above have exactly the same effect. In markup validation, they
make a huge difference. However, validators have a "doctype override"
feature.

As a general statement, "All that matters is that you either have a
doctype or you don't" is not correct at all. Different doctype strings
trigger different browser modes, see
http://hsivonen.iki.fi/doctype/

>> These days, just use <!DOCTYPE html> everywhere.


If you don't care about validation and your pages are ready for
Standards Mode (old pages generally aren't), then <!DOCTYPE html> is
simplest. The simplicity helps to avoid stupid mistakes in the doctype
string - a single mistyped character there can have drastic effects.

> So it's irrelevant?


Not at all if validation is considered.

> Do pages which validate as HTML 4 strict also validate as HTML 5?


No, that's a common misconception. Some examples of valid HTML 4.01
Strict features that cause an error message in HTML5 validation:
- the <acronym>, <big>, and <tt> elements
- <object> element inside <head> element
- several attributes, e.g. align=right in <td>
- <meta> tags in general: HTML 4.01 syntax is very liberal, allowing
<meta name=myidea content=whatever>, whereas HTML5 specifies a (messy)
mechanism for defining allowed variants and declares all the rest invalid.

The bottom line is: decide whether your documents will be closer to
HTML5 than to (some variant of) HTML 4.01, and select the doctype string
accordingly. This is just a practical issue: which choice gives your
fewer disturbing error messages about constructs that you use knowingly,
so that it is easier to check out the other messages (which may reveal
real errors)?

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

Gus Richter 02-13-2013 12:45 AM

Re: Declaring as HTML 4 strict or HTML 5?
 
On 2/12/2013 6:05 PM, Alfred Molon wrote:
> In article <timstreater-C79A22.23013512022013@news.individual.net>, Tim
> Streater says...
>> In article <MPG.2b84e60b9c91d8b098c96a@news.supernews.com>,
>> Alfred Molon wrote:
>>
>>> Should one declare HTML pages as HTML 4 strict or HTML 5?
>>>
>>> In other words use this header
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>>> "http://www.w3.org/TR/html4/strict.dtd">
>>>
>>> or this one
>>> <!DOCTYPE html>
>>>
>>> Or is it irrelevant?
>>>
>>> I'm asking because Google (on their maps API page) seem to suggest that
>>> pages should be declared as HTML 5.

>>
>> All that matters is that you either have a doctype or you don't. These
>> days, just use <!DOCTYPE html> everywhere.

>
> So it's irrelevant?
>
> Do pages which validate as HTML 4 strict also validate as HTML 5?


Yes.

I encourage you to red:

<http://diveinto.html5doctor.com/>

--
Gus





Gus Richter 02-13-2013 01:00 AM

Re: Declaring as HTML 4 strict or HTML 5?
 
On 2/12/2013 7:45 PM, Gus Richter wrote:
>> Do pages which validate as HTML 4 strict also validate as HTML 5?

>
> Yes.
>
> I encourage you to red:
>
> <http://diveinto.html5doctor.com/>


red = read

Mr. Korpela is right that not all HTML 4.01 documents will validate as
HTML5 "if the document is using Obsolete Features".

<http://www.whatwg.org/specs/web-apps/current-work/multipage/obsolete.html#obsolete>

--
Gus




All times are GMT. The time now is 04:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57