PDA

View Full Version : Why XHTML is useless.



carbonize
11-22-2003, 07:27 AM
Ok it's not totally useless but it's got a long way to go to be really useful. I have been making my new project in XHTML just for the sake of being upto date as some other members seem to think that any site not made in XHTML is antiquated. Anyways after making 8 pages in XHTML 1.0 strict, making sure they were all validated etc, I noticed an offsite link so went to add the target="" attribute, but what do you know, target="" is not valid XHTML. In fact there is no way, short of javascript, of opening a new window using XHTML. This is why I'm going back to HTML.

Narasinha
11-22-2003, 10:48 AM
Yeah, the target attribute is being phased out. It is still okay for transitional XHTML, but not for strict. Like you said, JavaScript is basically the only way to do it now.

There is a good article called New-Window Links in a Standards-Compliant World that describes a little about why it was done, and provides a very good section of JavaScript to open new windows. The article is located at http://www.sitepoint.com/article/1041.

The target attribute, along with other window controls, is still part of the DOM 2.0 standard, and should be in the future. Basically, XHTML is purely designed for content. Any actions performed are now to be done through the DOM by way of a scripting language such as JavaScript.

carbonize
11-22-2003, 11:02 AM
Yes but I'd sooner avoid javascript as not everybrowser supports it and some users have it switched off.

Narasinha
11-22-2003, 11:18 AM
Yeah, that definitely gets to be a problem. Do any browsers install with JavaScript turned off by default? I always leave it on (unless I'm testing something for a NOSCRIPT tag), but always have Opera set to only open requested popups. That takes care of my biggest headache with JavaScript.

Hey, I just found a page with a description of doing the target without JavaScript. It's at http://www.accessify.com/tutorials/standards-compliant-new-windows.asp. Basically it entails adding a non-deprecated module to XHTML. The W3C let the XHTML document type definition be flexible so that you can add your own modules. If you host the DTD on your own site, then refer to it in your DOCTYPE, you can add the target function and still be compliant! Pretty neat. I'll have to remember this one.

ranjan
11-22-2003, 07:08 PM
but what do you know, target="" is not valid XHTML

It is not valid HTML either. Its deprecated, which means you can only use the attribute with Transitional DTDs

carbonize
11-23-2003, 06:35 AM
Yes but at least it validates in transitional HTML which iis kind of my point, to get a new window in XHTML with valid code that not javascript is almost as much work as writing a piece of software.

Narasinha
11-23-2003, 12:27 PM
The target attribute is still valid for XHTML 1.0 transitional, but not at all in 1.1. Their explanation was that XHTML is concerned only with content. Any layout issues are covered by CSS, and any "actions" are covered by the DOM, usually with JavaScript (ECMAScript).

carbonize
11-24-2003, 07:53 AM
Well I redid the site in HTML 4.01 transitional but I'll try it as XHTML 1.1 transitional. Lets be honest it's just a case of putting in some \ at the end of certain tags as all of the formatting is handled by CSS.