Re: Suggestion: Check elment first, attribute second

Christian Smith wrote:
> 
> On Thursday, August 2, 2001 at 1:35 AM, bryce@obviously.com (Bryce
> Nesbitt) wrote:
> 
> > > > I've had trouble getting web page authors to use the validator,
> > > > because of issues like this (spurious error messages -- especially
> > > > because of valid Javascript).
> > >
> > > In what case is valid javascript causing errors to be reported?
> > > Examples?
> >
> > See http://www.htmlhelp.com/tools/validator/problems.html#script
> >
> > The w3c validator is basically useless for validating pages that
> > dynamically generate HTML with JavaScript.  While I don't expect the
> > validator to understand JavaScript, it could at least be silent about
> > the supposed syntax violations.
> 
> It can't be. There is no way for the validator to know if an error is one
> which will be cancelled out by something generated by the Javascript. The
> long and the short of it is that the HTML page needs to be valid HTML
> before AND after the Javascript is interpreted.

The validator could declare "I don't know what a script looks like in terms of
syntax" and ignore everything inside the <SCRIPT> container.  This matches
what a browser does, since it hands the <SCRIPT> to a seperate interpreter.

	<SCRIPT language="linenoise">
		*(@(*#&(@#&(@#@^%^%#@#@{@#@}#@}#{@}]{@}{#}@#{@&%%%%%;!<<!
	</SCRIPT>

Only a valid </SCRIPT> would end the exclusion block.  

				--------

If the validator EXECUTED the JavaScript, it could check the result.  Since
that's impractical, at least it can get out of the way, and not complain about
syntax it does not understand.

The remainder of the page then can be checked for validity.

			-Bryce

Received on Thursday, 2 August 2001 14:34:50 UTC