Re: noscript not allowed after script?

On Sat, 2004-03-13 at 23:23, David B wrote:
> How can you explain that having a <noscript></noscript> block
> immediately after a <script ...>...</script> block is an error?

<script> elements are allowed in more places then <noscript> elements.

Besides, 99.9% of the time <noscript> indicates low quality JavaScript.
Decent JavaScript will use object detection with graceful fallback to
HTML.

Simplistic example:
  <a href="foo.html" onclick="if (window.open) {
window.open(this.href,'window','width=300,height=300'); return false;
}">

(Of course, page author triggered new windows are generally a bad idea).

> :
>         Line 59, column 9: document type does not allow element
>         "NOSCRIPT" here; missing one of "APPLET", "OBJECT", "MAP",
>         "IFRAME", "BUTTON" start-tag
> :Missing the start tag of anything but a script to allow a noscript?

This is the SGML engine being clever.

It knows that <p>[1] can not contain <noscript>, but that <p> can
contain <object> and that <object> (ditto <map> etc) can contain
<noscript>, so it suggests that one of them is missing.

Of course this is nonsense, and demonstrates a limitation in the ability
of a DTD to express the language fully.

> By the way, how am I supposed to create an effect identical to
> <table><tr><td background="./img/bg/something.gif">...</td><!-- ...
> ... --></tr><!--... ... ...--></table> in "Valid HTML" without going
> toward the side of replacing every HTML attribute with CSS and thus
> degrading my site for users who have CSS support for some reason
> disabled or unavailable?

Given that the number of users who use a browser which supports the
invalid 'background' attribute to <td> and who have images enabled, and
who won't/don't parse the CSS is absolutely minute - this shouldn't be
an issue.

>  And why is that considdered to be an error when it displays properly
> en every graphical browser I've tested my site with?

If I were to say "John Smith is a ", and then roll my eyes and wave my
finger around my ear I think most people would know what I mean. The
action of rolling one's eyes and waving a finger around one's ear still
wouldn't be part of the English language.

Anyway - this isn't an issue with the Validator, this is an issue with
you not liking the HTML specification. I suggest you take this up in a
more appropriate forum.

[1] Its not a <p>, I just haven't memorised the HTML DTD in such detail
to be able to work out what it is.

-- 
David Dorward                                 <http://dorward.me.uk/>

Received on Friday, 19 March 2004 18:33:54 UTC