Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Declaring as HTML 4 strict or HTML 5?

Reply
Thread Tools

Re: Declaring as HTML 4 strict or HTML 5?

 
 
Tim Streater
Guest
Posts: n/a
 
      02-12-2013
In article <(E-Mail Removed)>,
Alfred Molon <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
Tim Streater
Guest
Posts: n/a
 
      02-12-2013
In article <(E-Mail Removed)>,
Alfred Molon <(E-Mail Removed)> wrote:

> In article <(E-Mail Removed)>, Tim
> Streater says...
> > In article <(E-Mail Removed)>,
> > 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
 
Reply With Quote
 
 
 
 
Jukka K. Korpela
Guest
Posts: n/a
 
      02-13-2013
2013-02-13 1:05, Alfred Molon wrote:

> In article <(E-Mail Removed)>, Tim
> Streater says...
>> In article <(E-Mail Removed)>,
>> 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/
 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      02-13-2013
On 2/12/2013 6:05 PM, Alfred Molon wrote:
> In article <(E-Mail Removed)>, Tim
> Streater says...
>> In article <(E-Mail Removed)>,
>> 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




 
Reply With Quote
 
Gus Richter
Guest
Posts: n/a
 
      02-13-2013
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Declaring as HTML 4 strict or HTML 5? Gus Richter HTML 0 02-13-2013 02:34 AM
Re: Declaring as HTML 4 strict or HTML 5? Lewis HTML 0 02-12-2013 11:10 PM
valid html strict KMA ASP .Net 3 04-25-2006 11:38 AM
Changing VS2005 to generate HTML 4.01/Strict instead of XHTML 1.0 Rob Roberts ASP .Net 5 01-20-2006 11:38 PM
upgrade to html 4.1 strict IhateSPAM HTML 1 07-02-2003 08:05 PM



Advertisments