[whatwg] Syntax highlighting language attribute for editable elements

Brett Zamir brettz9 at yahoo.com
Sat Jun 12 22:57:53 PDT 2010

Has thought been given to allow textarea, input and/or contenteditable 
elements to use an attribute (maybe like <code/> does with 
class=language-XX) so that user agents might be able to display the 
editable text with syntax highlighting code automatically?

This should not adversely affect users who do not have such browser 
support, nor does it put pressure on browsers to implement immediately 
(add-ons might take care of such a role). But having a convention in 
place (even if languages are not predefined) would ensure that the 
burden of implementing such support could be shifted away from the 
developer if they are not so inclined.

I'd prefer to see a dedicated attribute (also on <code/>) since the 
language type does convey general interest semantic information, but I 
think it would also ideally be consistent (i.e., the same attribute to 
be used in <code/> as in <textarea/>, etc.).

Maybe @lang/@xml:lang could be used for this purpose if its definition 
could someone be widened to recognize computer languages.

It would be nice, however, to also have some means of indicating that 
the web author is providing their own styling of the element in the 
event they wish to use their own editor.

thank you,
Brett Zamir

More information about the whatwg mailing list