[whatwg] Pressing Enter in contenteditable: <p> or <br> or <div>?
ehsan at mozilla.com
Wed May 18 12:22:43 PDT 2011
On 11-05-18 2:46 PM, Aryeh Gregor wrote:
>> Also, we should be preserving inline styles.
>> We should copy all attributes and have a blacklist of uncopyable attributes.
>> ID is the only one I can think of off the top of my head that needs
> accesskey, itemid, and name (on<a>) seem potentially problematic too.
> It's also possible that custom attributes, data-* or otherwise, might
> be issues, depending on how they're used. I guess in that case it's
> better to duplicate it and let authors figure out the consequences if
> it's wrong, than to destroy the info about what attributes it
> originally had.
> So probably it's okay to just blacklist id and<a name>.
What about itemid and accesskey? (There may be other examples that I'm
forgetting right now).
>> IMO, WebKit's behavior here is wrong. When you hit enter not in a block
>> Opera's behavior here seems right to me. If I understand correctly here's
>> what Opera does:
>> enter without a parent block: wrap everything in two block elements as
>> defined by the opera-defaultblock execCommand.
>> enter with a parent block: split the parent block
>> shift+enter: insert a BR
>> enter inside a header: breaks out of the header and inserts a block as per
>> the opera-defaultblock execCommand (this is just legacy we're stuck with
>> from IE5+)
> There's more magic than that. For instance, if you're in an<li> and
> hit Enter twice, all browsers will create a new<li> on the first
> Enter and then destroy it and move you outside the list on the second
Yes. Overall, this seems like a pretty sane basis on top of which we
can build the algorithm.
More information about the whatwg