By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,757 Members | 1,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,757 IT Pros & Developers. It's quick & easy.

Doctypes, validity etc.

P: n/a
Here's a chunk of a longer piece of punditry I'm working on, re: the
choices between doctypes for authoring and the State of the Union for
validity. I've got a bucketload of nasty code and a bunch of developers
who need education on validation, validity and all the usual good
stuff. In particular it's a problem of triage on the legacy code:
what's correctable now, what's going to need serious work, what's going
to be a total re-write.

I'd appreciate any comments you might have
Levels of Validity

Formally there are no "levels of validity". Validity is objective and a
document is either valid or not. For authoring we should keep to this
view. For assessing legacy documents though, it is useful to invent
some "levels" of validity. Remember that these are an arbitrary
invention with no formal definition and no standard comparability with
other projects or W3C recommendations. Validity can only be defined in
terms of a specific doctype, so these are defined against Strict.

Trivial invalidity

Use of the <a target="..." attribute. These would be valid
Transitional documents.

Documents are known to render exactly like valid Strict documents .

Minor invalidity

Inline elements placed directly into <bodyor <formelements. Use of
<fonttags. These would be valid Transitional documents.

Documents are known to render like valid Strict documents, because
browsers(sic) compensate(sic) automatically(sic) for these
"well-known"(sic) invalidities.

Major invalidity

Documents that are not even valid as Transitional. Typically this is
caused by improper nesting or closure of elements.

Rendering of these documents relies on SGML parsing producing a correct
DOM of the document elements. This is not a reliable authoring process:
although the SGML behaviour is deterministic, the effects are not
human-friendly and may give quite different elements from the tags that
the author used (particularly for invalid nestings).

It's even possible that "valid" legacy documents should be treated as
being majorly invalid. Where authors have mis-used the element closure
rules, the SGML behaviour is still clear for how this translates to the
DOM elements, but it may not be what the author expected. It's
difficult to identify these valid but incorrect documents, or to tell
some majorly and grossly invalid documents apart, without having
knowledge of what the author originally intended. This is why
automatic-correction of these afterwards is always a hard problem [12].

Grossly invalid

Tag-soup documents that barely resemble the DTD. These are still the
most common legacy documents.

Element set

There are massive advantages to abandoning "HTML 3.2" style layout with
its plethora of <fonttags, <tableused for layout and even the
single-pixel gif. These advantages come about by using the right
elements and ignoring the bogus ones though, not by any magic choice of
doctype.

Although it's true that using a Strict doctype will force you to do
this, it's just as easy to do so with a Transitional doctype. You can
write just as good markup under Transitional as you can under Strict,
it doesn't _require_ you to use <fontor to misuse <blockquotefor
indents.

Don't be afraid of Transitional. It's just as "good" as Strict, so
long as you aren't actually using any of the undesirable elements.
Equally, if you aren't using them then you could use the Strict
doctype. However, if the page is valid as Transitional but not as
Strict, then treating it as Transitional would allow the simple
objective validity test to be passed.

Transitional Differences

Transitional represents the shift in design philosophy from HTML 3.2 to
HTML 4.0 and CSS. The concept behind the two doctypes is that older
HTML 3.2 documents may simply be re labelled as HTML 4.01 Transitional
and that all new documents will be authored as HTML 4.01 Strict.
Transitional was only ever a temporary transitional phase and that was
7 years ago!

Legacy documents

We must accept that we have legacy documents, and that they'll be in
less than ideal form.
Legacy documents should be treated as invalid HTML 4.01 Strict
documents and should have an appropriate doctype declaration added
immediately. Then work on refactoring their validity, where possible.
It's better to do this than to leave them under the old doctypes: even
having valid HTML 3.2 wouldn't be a valuable distinction.

There will be many problems with legacy documents. They're likely to be
invalid, to use a poor set of elements and even to be not well-formed.
The difficulty of bringing them up to a "best practice" standard
depends on how bad particular examples are. Practically, well
formedness should be rapidly achievable, element use and validity may
be impractical to change.

In the rare case of almost-correct legacy documents (trivial or minor
invalidity, as described above), there could be a benefit to using a
Transitional doctype (see the discussion for new work). Otherwise it's
always best to label them as 4.01 Strict and at least gain the CSS
rendering benefits from it, rather than to label them as something
obscure albeit valid under that description. The web (as a consumer of
HTML, rather than an authoring problem) cares less about doctypes than
it does about content.

Nov 14 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesmiths.com>
wrote:
>I'd appreciate any comments you might have
These two bits seem to be contradictory:
>Don't be afraid of Transitional.
....
>We must accept that we have legacy documents, and that they'll be in
less than ideal form.
Legacy documents should be treated as invalid HTML 4.01 Strict
documents
Why not treat legacy docs as Transitional? That's what it's there for.

And then:
>It's just as "good" as Strict, so
long as you aren't actually using any of the undesirable elements.
But in that case there's no point in using Transitional. The thing about
Transitional is that it gives you a means of getting pages into a
reasonably sane state without having to go in for complete rewrites.

This is the key point, which should probably be placed earlier in the
piece:
>The concept behind the two doctypes is that older
HTML 3.2 documents may simply be re labelled as HTML 4.01 Transitional
and that all new documents will be authored as HTML 4.01 Strict.
I would suggest that if old documents are anywhere remotely near to
valid HTML 4.01 Transitional then you should make them valid
Transitional and not for the moment put any effort into making them
valid Strict.

Use Strict for new pages. Prioritise rewriting of old pages, giving
priority points to pages which are:
1) much visited;
2) frequently edited;
3) have really messy markup.

And when rewriting legacy pages, make no attempt to re-use any markup.
It just isn't worth it. Save the page as text, rescue the images and
start from scratch with the HTML and CSS. (I've done it once myself.)
>Transitional was only ever a temporary transitional phase and that was
7 years ago!
It's probably best to view Transitional in terms of page update
transitions rather than years. If one only gets around to updating a
1997 site in 2010 it might still be best to start by pushing the old
pages into (more-or-less) valid Transitional. They might then last a few
years more until you complete the rewrite ...

HTH

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 14 '06 #2

P: n/a
Also sprach Stephen Poley:
(more-or-less) valid Transitional.
like (more-or-less) pregnant?

SCNR,
Thomas
Nov 14 '06 #3

P: n/a

Stephen Poley wrote:
On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesmiths.com>
wrote:
Why not treat legacy docs as Transitional? That's what it's there for.
The problem is whether it's better to treat legacy documents as
Transitional or Strict.

My argument is that in nearly all practical cases, it's better to label
them as Strict and then proceed from there on. Only in a very narrow
set of cases is there any benefit from labelling them as Transitional.
Overall it's simpler and just as practially useful to label _all_ as
Strict consistently, rather than trying to make an awkward judgement
call on each one.

The documents in question are probably no better treated as
Transitional than as Strict, i.e. they're poorly authored, not just
authored well to an old standard.

Nov 14 '06 #4

P: n/a
On 14 Nov 2006 13:35:24 -0800, "Andy Dingley" <di*****@codesmiths.com>
wrote:
>Stephen Poley wrote:
>On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesmiths.com>
wrote:
>Why not treat legacy docs as Transitional? That's what it's there for.

The problem is whether it's better to treat legacy documents as
Transitional or Strict.

My argument is that in nearly all practical cases, it's better to label
them as Strict and then proceed from there on. Only in a very narrow
set of cases is there any benefit from labelling them as Transitional.
Overall it's simpler and just as practially useful to label _all_ as
Strict consistently, rather than trying to make an awkward judgement
call on each one.
I'm not suggesting making a judgement call on each one. I'm suggesting
labelling them all Transitional and only using Strict for new pages /
complete rewrites.

It isn't really an issue though as to what you *label* them. But if you
have the choice between making a dozen changes to produce a valid
Transitional document, or a hundred changes to produce a valid Strict
document, it's an easy choice ...
>The documents in question are probably no better treated as
Transitional than as Strict, i.e. they're poorly authored, not just
authored well to an old standard.
.... on the other hand, if they are really a complete mess, why put a
DOCTYPE on at all? I'd suggest leaving well alone until you can replace
them completely, as even adding a DOCTYPE might produce undesirable
side-effects in some browser.

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Nov 15 '06 #5

P: n/a
"Andy Dingley" <di*****@codesmiths.comwrites:
Major invalidity

Documents that are not even valid as Transitional. Typically this is
caused by improper nesting or closure of elements.
Maybe. Or (arguably) useful element types that are supported by most UAs
but not declared by W3C specs (who cares?).
Rendering of these documents relies on SGML parsing producing a correct
DOM of the document elements. This is not a reliable authoring process:
although the SGML behaviour is deterministic, the effects are not
human-friendly and may give quite different elements from the tags that
the author used (particularly for invalid nestings).
What have you been smoking? Missing end tags, improper nesting and such
can result in different DOMs, but that has nothing whatsoever to do with
SGML parsing (as far as common UAs are concerned).
There are massive advantages to abandoning "HTML 3.2" style layout with
its plethora of <fonttags, <tableused for layout and even the
single-pixel gif.
I prefer the null-pixel div too :)
Transitional was only ever a temporary transitional phase and that was
7 years ago!
HTML 4(.01) *introduced* features that were deprecated or marked
‘transitional’ on the fly (but already implemented in UAs; HTML 3.2? You
don’t say).
Legacy documents should be treated as invalid HTML 4.01 Strict
documents and should have an appropriate doctype declaration added
Like what?
Otherwise it's
always best to label them as 4.01 Strict and at least gain the CSS
rendering benefits from it,
Like additional and hardly documented IE 6/7 bugs?
rather than to label them as something
obscure albeit valid under that description.
<!DOCTYPE html>

is obscure enough since the WHATWG seems to claim it (and good enough
for ‘standards-compliant’ mode in most UAs, while the validation enabled
form ‘<!DOCTYPE html SYSTEM>’ is rather frowned upon by clue-impaired
implentations like Gecko).
--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011
Nov 16 '06 #6

P: n/a

Andy Dingley wrote:
Stephen Poley wrote:
On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesmiths.com>
wrote:
Why not treat legacy docs as Transitional? That's what it's there for.

The problem is whether it's better to treat legacy documents as
Transitional or Strict.

My argument is that in nearly all practical cases, it's better to label
them as Strict and then proceed from there on.
....

I'm not sure I follow. I think you (and Stpehen) were alluding to it,
but wouldn't a bigger concern (or at least a more practical one) be
whether to use a doctype that triggers standards vs. quirks mode?

Nick

--
Nick Theodorakis
ni**************@hotmail.com
contact form:
http://theodorakis.net/contact.html

Nov 16 '06 #7

P: n/a

Nick Theodorakis wrote:
I'm not sure I follow. I think you (and Stpehen) were alluding to it,
but wouldn't a bigger concern (or at least a more practical one) be
whether to use a doctype that triggers standards vs. quirks mode?
That's itself a reason to use Strict and trigger standards rendering
ASAP.

These documents are _ugly_. We're not in any position to worry about
the finer points of box model rendering just yet. If we ever do get to
that point, then I hope to arrive there from the direction of already
being in standards mode. I want to avoid all issues of "Well it used to
work when we rendered with quirks" by never having quirky rendering as
a significant issue.

This is a snippet from a longer document. It has taken 10 pages to
provide an unarguable case (I have a 3.2 / <tableluddite to work
around) for what's perfectly well described by the 1st page summary of
"Just stick 4.01 Strict on everything".

Nov 16 '06 #8

P: n/a

Andy Dingley wrote:
Nick Theodorakis wrote:
I'm not sure I follow. I think you (and Stpehen) were alluding to it,
but wouldn't a bigger concern (or at least a more practical one) be
whether to use a doctype that triggers standards vs. quirks mode?

That's itself a reason to use Strict and trigger standards rendering
ASAP.

These documents are _ugly_. We're not in any position to worry about
the finer points of box model rendering just yet. If we ever do get to
that point, then I hope to arrive there from the direction of already
being in standards mode. I want to avoid all issues of "Well it used to
work when we rendered with quirks" by never having quirky rendering as
a significant issue.

This is a snippet from a longer document. It has taken 10 pages to
provide an unarguable case (I have a 3.2 / <tableluddite to work
around) for what's perfectly well described by the 1st page summary of
"Just stick 4.01 Strict on everything".
Nov 16 '06 #9

P: n/a

Andy Dingley wrote:
Nick Theodorakis wrote:
I'm not sure I follow. I think you (and Stpehen) were alluding to it,
but wouldn't a bigger concern (or at least a more practical one) be
whether to use a doctype that triggers standards vs. quirks mode?

That's itself a reason to use Strict and trigger standards rendering
ASAP.

These documents are _ugly_. We're not in any position to worry about
the finer points of box model rendering just yet. If we ever do get to
that point, then I hope to arrive there from the direction of already
being in standards mode. I want to avoid all issues of "Well it used to
work when we rendered with quirks" by never having quirky rendering as
a significant issue.

This is a snippet from a longer document. It has taken 10 pages to
provide an unarguable case (I have a 3.2 / <tableluddite to work
around) for what's perfectly well described by the 1st page summary of
"Just stick 4.01 Strict on everything".
Nov 16 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.