[whatwg] What exactly is contentEditable for?

Ian Hickson ian at hixie.ch
Thu Aug 25 01:41:02 PDT 2005


On Wed, 24 Aug 2005, Matthew Raymond wrote:
> > 
> > Well, we already have <textarea accept>. It's up to you guys to 
> > convince UA makers to implement it. :-)
> 
> I think there are still issues to address with regards to <textarea 
> accept>. For example, are the HTML contents loaded into the DOM? Are 
> they treated like a separate document in an <iframe>, or are they more 
> like the contents of <div contenteditable>? Do they inherit their styles 
> from the current web page? I think all of this needs to be properly 
> defined, or |contenteditable| will win simply by virtue of inconsistent 
> implementation of <textarea accept>.

This is all already well-defined. The answers to your questions are, 
respectively, only as text nodes, no, no, no. It's just a <textarea> that 
can have syntax highlighting or other features, with all that being left 
up to the UA to decide, just like with text/plain <textarea>s.


> Here's an example of how poorly <textarea accept="text/html"> is 
> defined. When you press a reset button, the form controls return to 
> their defaults. So, if you press reset on a page with <textarea 
> accept="text/html">, it should restore the default contents of the 
> <textarea>. This means the child text of <textarea> must be maintained 
> or you can't do a reset for that control.

Yes.


> So, where are the modified
> HTML contents of the control when it's being edited? In the DOM?

In .value (as opposed to .defaultValue).

This is _exactly_ the same as for a text/plain <textarea>.


> This would suggest that <textarea> HTML contents need to be in a 
> separate document object. If that's the case, how is styling handled? 
> Does it inherit from the parent document? What would a selector like 
> "textarea > p" do?

You seem to be making unwarranted assumptions about this feature. There is 
_absolutely no difference_, from an authoring or DOM perspective, between 
a text/plain <textarea> and a text/html <textarea>. The difference is 
_only_ from a UA and user point of view, and only in terms of UI.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list