Using the X in XHTML to make hacks work in validators

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using the X in XHTML to make hacks work in validators

Tei-2
People like Google and others add stuff to his webpages to fix general
problems. I call that hacks "Crown Control Hacks".
One of that hacks is rel=nofollow,  other is autocomplete="off"  (that
one is created by mozilla, I think).

This make my XHTML validator cry, and show a ugly red error number > 0.
I want my XHTML validator happy, and show a error=0 in big, green letters.

So..  maybe I can use the X in XHTML and *extend*

Thats my first attemp (one to extend XHTML to add autocomplete to a input box.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[
 <!ATTLIST html
     xmlns:goo CDATA #FIXED "http://zerror.com/google/autocomplete"
 >
 <!ATTLIST input autocomplete CDATA #IMPLIED>
]
>
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"
     xmlns:goo="http://zerror.com/google/autocomplete" >
 <head><title>Example</title></head>
 <body>
       <input type="text" name="search" autocomplete="on"
value="Looks mon, no hands!" />
 </body>
</html>

Of course, don't work:
- The validator seems happy with the code. (WIN!)
- Browsers hate my code and show the "]>" , but maybe is me... tryiing
to run XHTML on HTML browsers with the wrong mime type.(FAIL!)

Any idea?

It has to run on IE and Firefox.   (NOTE: I use text/html to make IE
happy, but If a different mime type can help, I want to know)




--
--
ℱin del ℳensaje.
Reply | Threaded
Open this post in threaded view
|

Re: Using the X in XHTML to make hacks work in validators

Kornel Lesiński

On Thu, 20 Nov 2008 17:32:36 -0000, Tei <[hidden email]> wrote:

> Any idea?

If you just want to appease the W3C Validator, then write your own DTD.

I've written one that allows <input type=search>:

<!DOCTYPE html PUBLIC "-//KURS BROWSEHAPPY//DTD XHTML 1.0 Strict +  
Hacks//EN" "http://kurs.browsehappy.pl/xhtml.dtd">
See http://kurs.browsehappy.pl/xhtml.dtd

It's not using the X of XHTML. For HTML it looks almost identical.

--
regards, Kornel Lesinski


Reply | Threaded
Open this post in threaded view
|

Re: Using the X in XHTML to make hacks work in validators

bhawkeslewis

Kornel Lesinski wrote:
> If you just want to appease the W3C Validator, then write your own DTD.
>
> I've written one that allows <input type=search>:
>
> <!DOCTYPE html PUBLIC "-//KURS BROWSEHAPPY//DTD XHTML 1.0 Strict +
> Hacks//EN" "http://kurs.browsehappy.pl/xhtml.dtd">
> See http://kurs.browsehappy.pl/xhtml.dtd
>
> It's not using the X of XHTML. For HTML it looks almost identical.

In case it's not obvious, this may "validate", but you're no longer
validating XHTML 1.0 Strict.

Compare:

http://www.alistapart.com/articles/customdtds2/

There's a value in using a custom DTD (or a schema, or anything really)
to enforce your own coding standards.

There seems very little value in "appeas[ing]" the validator as though
it were some sort of deity demanding blood sacrifice.

--
Benjamin Hawkes-Lewis


Reply | Threaded
Open this post in threaded view
|

Re: Using the X in XHTML to make hacks work in validators

bhawkeslewis
In reply to this post by Tei-2

Tei wrote:
> People like Google and others add stuff to his webpages to fix general
> problems. I call that hacks "Crown Control Hacks".
> One of that hacks is rel=nofollow,  other is autocomplete="off"  (that
> one is created by mozilla, I think).

For what it's worth, rel="nofollow" is entirely valid in HTML 4.x and
XHTML 1.x, although to be conforming technically you should include a
profile attribute that defines "nofollow".

autocomplete was invented by Microsoft. Given Opera doesn't pay any
attention to it by default, its utility is somewhat questionable.

> - Browsers hate my code and show the "]>" , but maybe is me... tryiing
> to run XHTML on HTML browsers with the wrong mime type.(FAIL!)

IIRC this represents an "error" in how some browsers parse HTML.

In any case, it's a well-publicized issue with appending to the DTD in
this way:

http://www.alistapart.com/articles/customdtd/

> It has to run on IE and Firefox.   (NOTE: I use text/html to make IE
> happy, but If a different mime type can help, I want to know)

I believe you can swap in a different DTD with a local copy of the
validator, so there's no special need to mess around with custom DTDs in
this way.

It's not like what you're doing is conformant anyhow, so the only
purpose of validation is to ensure that you're coding what you meant to
code.

You might consider using draft HTML5, since it might one day standardize
the features you want. It includes autocomplete, not that it requires
browsers to implement it (since it's regarded as a user-hostile feature
desired by banks).

The validator already has experimental support for it.

--
Benjamin Hawkes-Lewis

Reply | Threaded
Open this post in threaded view
|

Re: Using the X in XHTML to make hacks work in validators

Philip Taylor (Webmaster, Ret'd)



Benjamin Hawkes-Lewis wrote:

> autocomplete was invented by Microsoft. Given Opera doesn't pay any
> attention to it by default, its utility is somewhat questionable.

Isn't that affording Opera a rather more significant
role than it actually has ?  If you'd cited the
Gecko/Mozilla family, I would have accepted your
statement without comment, but Opera is rather
"niche", isn't it ?

** Phil.

Reply | Threaded
Open this post in threaded view
|

Re: Using the X in XHTML to make hacks work in validators

Philip Taylor (Webmaster, Ret'd)

Apologies, this was meant to be an off-list message.

Philip TAYLOR (Ret'd) wrote:

> Isn't that affording Opera a rather more significant
> role than it actually has ?  If you'd cited the
> Gecko/Mozilla family, I would have accepted your
> statement without comment, but Opera is rather
> "niche", isn't it ?