[whatwg] What exactly is contentEditable for?

Ian Hickson ian at hixie.ch
Wed Aug 24 05:16:34 PDT 2005


On Wed, 24 Aug 2005, Hallvord Reiar Michaelsen Steen wrote:
> On 24 Aug 2005 at 0:17, Ian Hickson wrote:
> 
> > > Could we extend contentEditable in a way that would let the UA offer a 
> > > non-scripting UI for "saving" the edited page? For example using the 
> > > "form" attribute from WF2?
> > 
> > What's wrong with File > Save ?
> 
> I meant "Save" as in "submit to the server" (thought the sample code 
> would make that clear). File > Save puts a copy of the file on your hard 
> disk (if you have one) and should continue to do so.

Ah, ok.


> Repeating example: 
> using
>
> <form id="saveform" action="" method="put"></form>
> 
> <div contentEditable="true" form="saveform"></div>
> 
> lets the UA know that it can offer a "save edits" UI to the user that 
> submits the edited contents as a PUT request to the current URL.

Well, you can do that now:

<form action="" method="post"
      onsubmit="savedata.value = firstChild.innerHTML"
  ><div contentEditable="true"></div>
   <input name="savedata" type="hidden">
</form>

Not quite the same, I guess. If we wanted to say that the UA could PUT the 
document back to the same URI if it was modified, though, I'd suggest 
using the HTTP header "Allow: PUT" when serving the content in the first 
place. Better than modifying the document itself IMHO. (Especially if you 
consider that the page might be copied to other servers that don't support 
it, e.g. in mirroring networks.)


> Most contentEditable uses would still use scripting of course, since IE 
> doesn't support the form attribute on editable elements, but with this 
> we have a noscript option.

contentEditable needs scripting anyway, to offer things like "insert <em> 
element here", etc.

-- 
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