W3C home > Mailing lists > Public > www-validator@w3.org > March 2006

Re: TEXTAREA Validation?

From: Jukka K. Korpela <jkorpela@cs.tut.fi>
Date: Fri, 24 Mar 2006 09:55:53 +0200 (EET)
To: Will Fastie <web@fastie.net>
cc: www-validator@w3.org
Message-ID: <Pine.GSO.4.64.0603240951010.28174@korppi.cs.tut.fi>

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

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 14:17:48 UTC