|
Posted by I V on 10/03/29 12:01
On Sat, 26 Jan 2008 16:49:13 -0500, Jeff wrote:
> Why not? If I want to validate the page as I'm working on it I won't
> have to wade through the 47 errors the validator thinks it sees in the
> javascript where I'm assembling bits of html.
What validator are you using? In HTML (but not XHTML), the content of a
script element is already considered CDATA, so the validator shouldn't
complain about HTML fragments in the script. I've just checked the W3C's
validator and it thinks this is valid, for instance:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>I AM YOUR DOCUMENT TITLE REPLACE ME</title>
<script type="text/javascript">
document.write('<foobar>');
</script>
</head>
<body>
<p>
Something in the body.
</p>
</body>
</html>
Navigation:
[Reply to this message]
|