Re: TEXTAREA Validation?

On Thu, 23 Mar 2006, Will Fastie wrote:

> On a page with several textareas containing code (JavaScript) for display
> (as opposed to being on a form), the validator issued various errors and
> warnings about the content of the textareas.

Textarea elements are for user input, not display of data. Using them for 
data display isn't a validity problem as such but easily confuses both 
users and the author. Note that JavaScript code included as page content 
(as opposite to appearing as code inside <script> elements or event 
attributes) is subject to all the normal rules of HTML. An "&" or "<", for 
example, needs to be "escaped".

> Is this the expected behavior or should the validator ignore textarea
> content?

A validator is required to process textarea content as page content 
(insted of skipping or ignoring it). Due to the content model of the 
textarea element, no tags are allowed there, but "&" or "<" still have 
their special meanings unless "escaped". If you have "<foo>" inside 
textarea, a validator must parse it as a tag and then issue an error 
message, since no tags are allowed.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

Received on Friday, 24 March 2006 07:56:05 UTC