473,394 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Doctypes, validity etc.

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
9 1632
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
Also sprach Stephen Poley:
(more-or-less) valid Transitional.
like (more-or-less) pregnant?

SCNR,
Thomas
Nov 14 '06 #3

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
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
"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

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

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

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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: vishal | last post by:
how can i verify the email address entered by client??? is there any readily available function for that in php or mysql????? else suggest me some links for verifying email address enetered...
3
by: Rex_chaos | last post by:
Hi there, I have a question about using expression template. We know that the final calculation in expression template will end up with a series of element-by-element operations. The concept can...
15
by: Viken Karaguesian | last post by:
Hello all, I'm having a problem with DOCTYPES. Until now, I haven't been specifying doctypes. I want to start specifying doctypes, but am having trouble doing so. Whenever I specify a doctype,...
12
by: Troy | last post by:
My ISP provides me with 2 servers: one for normal web hosting (non-PHP) and a CGI server (with PHP). I create my website using fusion 7 and upload this in its entirity to the web hosting server....
16
by: jacob navia | last post by:
Valid pointers have two states. Either empty (NULL), or filled with an address that must be at a valid address. Valid addresses are: 1) The current global context. The first byte of the data...
33
by: a | last post by:
Hi, I have a pointer that points to an unknown heap memory block, is it possible to check the pointer + 3 is valid or not? If it is impossible, how can I do the check? Thanks
2
by: shuisheng | last post by:
Dear All, Assume I have a class for a cuboid domain. The domain is defined by the cuboid's lower corner, such as (0, 0, 0), and upper corner, such as (1, 1, 1). The upper corner should be always...
9
by: xhe | last post by:
Hi, I need to program to check the validity of IP address through PHP Initially I used this one: $url="http://www.ntc.gov.au/ViewPage.aspx? page=A02400304500100020"; $fp=fopen($url,"r");...
4
by: istillshine | last post by:
I have a function foo, shown below. Is it a good idea to test each argument against my assumption? I think it is safer. However, I notice that people usually don't test the validity of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.