Righteous Wrath Online Community

General => Lobby => Topic started by: Shayne on December 13, 2005, 10:10:17 AM

Title: Specifing a DOCTYPE, is it really needed?
Post by: Shayne on December 13, 2005, 10:10:17 AM
So im sick, but i thought i would muck around in some AJAX stuff that ive been wanting to see if its possible.  While doing some stuff i noticed that HTML was WAY WAY WAY more flexable if you just omitted the top DOCTYPE.



I know why its there, in theory its supposed to make sure that all browsers render the same code the same way.  Well if this worked id be a munkeys uncle.



By omitting it you have access to non-standard, but widely supported features such as "background" on a <td>, "height" on a <table>, other wise these dont work.



Is it wrong to bastardize HTML like that?  :)  I couldnt see why not, we have constantly been complaining about how things SHOULD work, and with the restrictions of a DOCTYPE things dont work the way I WANT them too.



*shrug*  Its a moral problem.  I'd love to do certain things, but id also like to validate, but will being invalid break my heart...not likely.
Title: Re: Specifing a DOCTYPE, is it really needed?
Post by: Darren Dirt on December 13, 2005, 10:56:09 AM
Quote from: "Shayne"So im sick, but i thought i would muck around in some AJAX stuff that ive been wanting to see if its possible.  While doing some stuff i noticed that HTML was WAY WAY WAY more flexable if you just omitted the top DOCTYPE.



I know why its there, in theory its supposed to make sure that all browsers render the same code the same way.  Well if this worked id be a munkeys uncle.



By omitting it you have access to non-standard, but widely supported features such as "background" on a <td>, "height" on a <table>, other wise these dont work.



Is it wrong to bastardize HTML like that?  :)  I couldnt see why not, we have constantly been complaining about how things SHOULD work, and with the restrictions of a DOCTYPE things dont work the way I WANT them too.



*shrug*  Its a moral problem.  I'd love to do certain things, but id also like to validate, but will being invalid break my heart...not likely.



...so, validate the page after removing the extra bits and the doctype... I mean, I think standards are great, but if you have a goal in mind for a page (whether application functionality or design) and the thing preventing you from reaching that goal is that you won't be able to have a tiny image on there saying it's 100% pure then really haven't we regressed as devs? I naturally do proper XHTML for the most part (i.e. <td class="myClassName"> and <br /> instead of <TD CLASS=myClassName> and <BR> etc. ) but I agree with you about things like "background=" or "height="... sometimes it's the quickest way of something working, validators be darned.  :lol:



Just curious, what will your AJAX page do? Is it a single-function thingie, or does it integrate with a large system you've been messing around with?



- - -



PS: If you're "sick" with what I had last week, and I know others are getting, let me speculate: First you wake up at 5am and dash to the bathroom, and during the next 4 to 6 hours you proceed to empty your guts (one way or the other). You sleep most of this first day, perhaps waking up every hour, on the hour, to dry heave and then sip a bit of juice to prevent dehydration. The next day you feel pretty much fine. Towards the end of that next day, you notice some muscle joint pain, a weird headache... then some shoulder muscle tightness also leading to the chest area. The next morning you wake up, you feel pretty okay, but soon as you try to go about a normal workday, you find the chest tightness is now painful, and now one of your arms hurts almost like an elbow funny bone pain. That funny bone like pain turns into severe carpal tunnel syndrome, possibly in your left arm even though you're right handed and haven't been doing major typing so it's unexplainable. A cold wet paper towel helps keep the tendon and blood vessel inflamation down. You grumble how you thought you were over this stupid bug. The next day you're pretty much over it all, but the headache is still pretty strong and doesn't go away completely no matter how much sleep, water, or healthy food you partake in.



It took me exactly 6 days start to finish to recover. Hope you're getting lots of sleep. Curious, did I sum up your experiences? Or anyone else's on here?  :o
Title: Specifing a DOCTYPE, is it really needed?
Post by: Cova on December 13, 2005, 01:04:04 PM
I don't think I've ever seen or used a doctype tag in a page before, though I don't do a lot of web development.  But I would say, if it works, do it.



QuoteI think standards are great, but if you have a goal in mind for a page (whether application functionality or design) and the thing preventing you from reaching that goal is that you won't be able to have a tiny image on there saying it's 100% pure then really haven't we regressed as devs?



I'm not quite sure which way you're argueing that point - if we are "regressing" from breaking XHTML, or from letting a standard get in the way of making it work.  Either way, it really reminds me of that grumpy-programmer blog post that someone linked in another thread a day or two ago here.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Mr. Analog on December 13, 2005, 01:39:11 PM
All specifying doctype really does is ensure which processor is being used to parse your document, otherwise the client guesses based on content and you could get unexpected results.



Case in point, use the same CSS Level 2 stylesheet on different HTML pages that specify 4.01 transitional, 4.01 and one that has no doctype set, and you'll see some differences.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Shayne on December 13, 2005, 03:07:18 PM
Guess it depends on how extreme ones CSS is.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Mr. Analog on December 13, 2005, 03:15:13 PM
Or how good / bad the parser is too.
Title: Re: Specifing a DOCTYPE, is it really needed?
Post by: Thorin on December 13, 2005, 03:33:41 PM
Quote from: "Shayne"By omitting [DOCTYPE] you have access to non-standard, but widely supported features such as "background" on a <td>, "height" on a <table>



Will your target audience ever use a standards-based browser that will not support non-standard features?  If yes, it's a problem; if no, it's not a problem.



Of course, the whole point behind using standards-based browsers, coding to standards, and not using non-standard features is to keep from forcing all users to have to use the same browser.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Mr. Analog on December 13, 2005, 03:50:06 PM
The main problem I have with IEs parser is that it decides based on relative content how to parse your markup + stylesheet, so when you don't specify what parser to use it's just guessing.



The worst is when the parser changes slightly between IE versions (or even in some casess the same IE version but a different platform) it can and will behave in unexpected ways. This isn't to say the Microsoft doesn't implement a good parser in there somewhere, in fact I rather like the efficiency of their XHTML parser (it's an extension of their XML 3.0 engine) you just have to make sure you've specified, precisely, that you want your document to be processed with that parser and that that document absolutly conforms to that standard (if IE spots some 4.01 Transitional content it switchs parsers on you automatically).



The benefits for stamping something like this into your HTML (for example) far outweigh the minor hinderances of keeping things "compliant".



<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">

<head profile="http://www.w3.org/2000/08/w3c-synd/#">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



<title>Blah</title>



<style type="text/css" title="currentStyle">

@import "blah.css";

</style>



</head>

<body />

</html>
Title: Specifing a DOCTYPE, is it really needed?
Post by: Cova on December 13, 2005, 04:46:12 PM
Quote from: "Mr. Analog"
<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">

<head profile="http://www.w3.org/2000/08/w3c-synd/#">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



<title>Blah</title>



<style type="text/css" title="currentStyle">

@import "blah.css";

</style>



</head>

<body />

</html>



You see - I'd just do something like this, and be done with it with a LOT less typing...




<html><head>

<title>Blah</title></head>

<body>

Content Goes Here

</body></html>




But like I said before, I don't do much web development.  I much prefer coding in a compiled language - you compile it and it runs the same everywhere, no browsers and stuff involved.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Shayne on December 14, 2005, 07:18:07 AM
On the topic of XHTML, i have yet to find a "real" reason to go in this direction.  While i can see certain websites that may need to be viewed on other appliances, but building a complex system full of dynamic ajax content and such, it really doesnt matter that it can be viewed if its not gonna work.



div based layouts are lame too.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Thorin on December 14, 2005, 03:57:32 PM
Quote from: "Shayne"On the topic of XHTML, i have yet to find a "real" reason to go in this direction.  While i can see certain websites that may need to be viewed on other appliances, but building a complex system full of dynamic ajax content and such, it really doesnt matter that it can be viewed if its not gonna work.



div based layouts are lame too.

Uh, I missed the connection between "XHTML" and "its not gonna work".  What?



By the way, it sounds like you've made up your mind, so why bother asking?
Title: Specifing a DOCTYPE, is it really needed?
Post by: Shayne on December 14, 2005, 04:01:30 PM
The connection was MrA's example, and i made my decision,yes, but i was curious to know the opinions of our fellow forum goers.  Perhaps next time i should just not post?
Title: Specifing a DOCTYPE, is it really needed?
Post by: Thorin on December 14, 2005, 04:20:15 PM
Okay, so I tried the example code.  I viewed it in both IE6 and FF1.5.  No errors reported.  I don't see how you can say that it's not going to work.  And I certainly don't see how even if the code didn't work, how that would have anything to do with whether XHTML is of any use or not.



QuoteSpecifing a DOCTYPE, is it really needed?

If you've already made up your mind, don't ask the question.  Simply state your opinion, like so:

QuoteSpecifying a DOCTYPE isn't needed, I say

That way we don't waste our time trying to convince you of something you don't want to change your opinion on.



Notice I said nothing about not posting there.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Darren Dirt on December 14, 2005, 04:42:33 PM
I for one am glad Shayne posted.



Obviously he has some HTML tag attributes that are "obsolete" but serve his functions just fine, thank you very much, and so he wanted to know if the benefits of including DOCTYPE outweighed the down side, such as the exclusion of the obsolete stuff. That's my take on it anyway.



Plus Mr. Analog was nice enough to include a complete list of apparently EVERY extra doctype-like attribute and tag and whatever you could possibly want to include (i.e. HEADER on each page of your website, you standards addicts!) while Cova apparently values his wrist tendons over standards. Me too. I'll go with trimming the fat ;)
Title: Specifing a DOCTYPE, is it really needed?
Post by: Cova on December 14, 2005, 04:52:35 PM
Quote from: "Darren Dirt"... while Cova apparently values his wrist tendons over standards.



How about saving bandwidth.  The two quotes in my last post are 503 and 83 bytes each (and the 83-byte page has 3 words of content - 3 more than the big one).  Serving static pages, which is almost always bandwidth limited, you could serve over 6 times as many pages.
Title: Specifing a DOCTYPE, is it really needed?
Post by: Mr. Analog on December 14, 2005, 05:31:52 PM
All I'm saying is this:



Specifying DOCTYPE and adhering to W3C Standards is applicable when:



-You want your content to be processed by a specific parser if available



-You want your content processed by a wide variety of clients be aware of standard implementations



Additionally:



-If you need markup that can be programmatically accessable with a particluar parser; specify it and adhere to the standards req'd for that parser (e.g. XHTML)



-Use the right tag for the right job, DIV tags aren't for tabular data the same way tables aren't for divisional boundaries.



-Reliance on proprietary client tools is a limitation



-If you want to save bandwidth, be aware of your inteded user and use the proper tools or design patterns at your disposal (HTML 3.2 with no image files)



The bottom line for web development is always consider the userbase and the future of your application. If you know your entire userbase is locked into using IE 6.x on a specific Windows platform then you can code anything that fits within that schema (the same way you would write a desktop client application, knowing the target deployment platform is important for a variety of reasons). If you know that you will never, ever have to run your web application through an XML parser don't bother conforming to XHTML. Above all else, use your own discretion.