Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
How much pragmatism should we use when dealing with (X)HTML validation ?
Old 12-14-2007, 06:02 AM How much pragmatism should we use when dealing with (X)HTML validation ?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
That question hitted me yesterday...

A bit of explanation...
I'm currently designing a demo site build around an XML+XSL framework I've been working a bit lately.

As I love (and really love, not just like) javascript and DOM scripting, I thought to myself that it would be really cool, if we could separate javascript as we could do with css.
I mean, no <script> elements anywhere else than defining the source files in the header.

For that, I decided to tag my HTML elements with specific attributes.
My different JS objects are then scanning the dom tree, to detect which elements are tagged, and applies them specific behaviors, and sometimes even totally rewrite them.

For exemple, I've wrote an js object, that will fetch every div's with an js:tab="name of tab" attribute, and it will create a tabbed composant with every div's tagged like that.
It don't just add an tabbed header, it re-create an tabbed structure, while deleting the original elements from the DOM tree.

It works perfect, it's clean in the HTML source and it degrade very well, as someone without JS enabled will just have a series of div on screen.
You can see it live there:
http://dating.webalis.com/signup.php

Quote:
I know, the html is not valid, but it's because when I force the server to transform XML+XSL in HTML, it don't follow the specified doctype.
If anyone have infos about how you can force the PHP5 XSLT engine to XHTML rather than HTML output mode is welcome...
But, of course, I have now a HTML source that is no more w3c compliant, because js:tag is not a recognized attribute.

So, even if for myself my mind is well set on that subject, I'm curious to hear about yours.
If you could integrate something like that in your pages, would you mind loosing w3c compliance for the benefit of this ?
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
 
Register now for full access!
Old 12-14-2007, 11:06 PM Re: How much pragmatism should we use when dealing with (X)HTML validation ?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
For scripts like this, I use the class name. Class names allow multiple classes per tag ( e.g. class="tab coolClassName" ). It's nice and compliant and fits with the fact that the objects are within a logical class named "tab" while allowing proper CSS via "coolClassName". For example, on http://www.memberscript.com/signup.php (a client's site), you'll notice that typing in a box beyond it's boundary stretches the box automatically, but if the INPUT tag's class name includes "no_resize" (no example on that page) then the javascript ignores that field for automatic resizing.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 12-15-2007, 12:30 PM Re: How much pragmatism should we use when dealing with (X)HTML validation ?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I thought of that too, and hesitated a bit.
But what I was looking to was to separate javascript, not to mix it with css...

I wanted to have the datas (XML), the presentation (XSL+CSS) and the "front end" logic (JS) each separated from each.

As I said, loosing w3c compliance in that way is no big deal to me. The document stay semantically clean and well formated.
This looks even like a hole in their credo, as we are allowed to add namespaces, but the document don't validate anymore after that....
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 12-15-2007, 12:38 PM Re: How much pragmatism should we use when dealing with (X)HTML validation ?
Defies a Status

Posts: 3,420
Trades: 0
Web standards are a guide. Some major web sites have hundreds of validation mistakes - that certainly isn't good. If you conform to most of them, then you're doing alright. I try to make my sites validate, but if they don't, it's not a massive problem. Getting them as close to web standards as possible should be the key.

One problem that always annoys me when I'm making sites is that you can't place a <div> inside of an <a> tag. This is usually to get a workaround for the IE6 transparent PNG bug - I place an image inside of the <a> tag, then block this with CSS for IE6, then apply a background to the <div>. The <a> is there for logos and things so people can go back to the home page at the click of a button. I know this isn't great web standards, but it's hardly affecting the browser at all and will enhance, not impair, the user experience.
CSS4Life is offline
Reply With Quote
View Public Profile
 
Old 12-15-2007, 06:52 PM Re: How much pragmatism should we use when dealing with (X)HTML validation ?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Whym: Have you considered handling the div's onclick event?

Custom name spaces are painful. I've done some experimenting with them, and could never get what I wanted, which is a bit different from your example, but not all that much.

I would pretty strongly consider different class names, since you can use a list of them. On the other hand, you could more cleanly separate the markup from the script by defining which elements should be acted on in your script, rather than by attaching different attributes to them. That obviously doesn't make sense ... but it's arguably the 'cleanest' method. With that in mind, I think I've got to agree with Daniel and say web standards are great advice, but not law. If a page doesn't validate, but does everything that's needed, that might be a better solution...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Reply     « Reply to How much pragmatism should we use when dealing with (X)HTML validation ?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25548 seconds with 12 queries