Forums.Counter-Strike.com | Counter-Strike Community Forums

Go Back   Forums.Counter-Strike.com | Counter-Strike Community Forums > Miscellaneous > Off Topic > Web Design
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

COD4 Servers
Reply
 
LinkBack Thread Tools Search this Thread
Old 11-01-2006, 06:26 AM   #1 (permalink)
combenetorg
Member
Counter-Terrorist
 
combenetorg's Avatar
 
Join Date: Nov 2006
Posts: 233
Exclamation XHTML Validator Bug?

s the validator at fault?

I wrote a script that grabs quite a bit of data to pass as post data to a PHP script via ajax. When I tried to validate the page, I got all kinds of errors about ampersand entities. Obviously, replacing them with & will make the data request NOT work, so is this a fault with the validator (i.e. the document IS valid) or is there some other way I should be doing this?

Here's a mini-example with GET:

html4strict Code:

1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2. <html xmlns="http://www.w3.org/1999/xhtml">
3. <head>
4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5. <title>Validator Test</title>
6. <script type="text/javascript">
7.
8. var exampleGetString;
9. exampleGetString = "?somedata=1";
10. exampleGetString += "&failedvalidation=1";
11.

12. </script>
13. </head>
14.

15. <body>
16. </body>
17. </html>
combenetorg is offline   Reply With Quote
Old 11-01-2006, 06:54 AM   #2 (permalink)
Guilty
Member
Hostage
 
Guilty's Avatar
 
Join Date: Nov 2006
Posts: 39
Default Re: XHTML Validator Bug?

It's kinda your fault. As xhtml, you need to declare the script to be cdata.
Code:

<script type="text/javascript"> //<![CDATA[ var exampleGetString; exampleGetString = "?somedata=1"; exampleGetString += "&failedvalidation=1"; //]]> </script>

The browser doesn't care, because it's treating the doc as html, but the validator takes you at your word. Even if validating html, it's probably a good idea to enclose the script within comment tags. Not sure on the last, as I haven't written an html page in ages.

cheers,
Guilty is offline   Reply With Quote
Reply

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 On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 10:20 AM.



Powered by vBulletin Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC5
Free Clan Websites and Template Hosting