473,624 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(s ic) 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 <blockquotefo r
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 1643
On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesm iths.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*****@codesm iths.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*****@codesm iths.com>
wrote:
>Stephen Poley wrote:
>On 14 Nov 2006 06:26:25 -0800, "Andy Dingley" <di*****@codesm iths.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*****@codesm iths.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*****@codesm iths.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
5280
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 by client. thxs for help in advance.
3
3703
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 be explained with W = X o Y o Z; (here o denotes any operator) W.operator = LOR(LOR<X, o, Y>, o, Z); and in W.operator=, we have
15
1985
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, *any* doctype, *I almost always* get a horizontal scroll bar in IE, but not in Firefox/Opera. It seems as if the page stretches beyond the browsers borders. Even if I set ultra-narrow margins and only have one word on the page, I get a
12
2495
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. If I want to run CGI scripts, I can do so with an external link to a page on the CGI server. The problem however is that I have to maintain two sites and all associated links. Ideally, I'd like everything to be in one place, but I'm not allowed...
16
3366
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 of the program till the last byte. Here we find static tables, global context pointers, etc. This are the global variables of the program.
33
4537
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
1923
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 higher than the lower corner. I write a code as below class Domain { private:
9
2965
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"); if(!$fp) {
4
3285
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 arguments. For example, #define MAX_SIZE 100000 int foo(double *x, unsigned ling sz, int option) {
0
8242
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8681
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6112
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.