This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15522 - Add execCommand() to Element
Summary: Add execCommand() to Element
Status: NEW
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - HTML Editing APIs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 enhancement
Target Milestone: ---
Deadline: 2015-07-30
Assignee: Aryeh Gregor
QA Contact: HTML Editing APIs spec bugbot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-11 16:10 UTC by Aryeh Gregor
Modified: 2015-07-30 23:47 UTC (History)
4 users (show)

See Also:


Attachments

Description Aryeh Gregor 2012-01-11 16:10:46 UTC
Suggested by Ojan Vafai: http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/0090.html

I think we should expose it something like this:

* If the element does not have contenteditable set to true, throw.  (This means we should also throw for the body of a document with designMode, unless that body also has contenteditable=true.)
* For things like styleWithCSS, set the flag for that editing host and its descendants only.
* For regular commands like bold, run the command restricted to the descendants of that editing host.

This solves the problem of clicking the B button next to one editing host and making text in another editing host bold, or styleWithCss etc. changes leaking between editing hosts.  If we do this, I'd also be okay with adding new flags.

There are two important changes we'd need here, I think:

1) Make a concept of "editing flags" or something (not a good name; they might contain data, not just booleans).  The document always has a value for each editing flag, and you can set them on an editing host too by calling execCommand() on it, but by default they're all set to "inherit" for non-document editing hosts.  To get the editing flag for an element, go up the DOM until you hit something with the flag set.  Then change things like "If the CSS styling flag is false:" to "If the CSS styling flag for node is false:".

2) Change things like "Let element list be all editable Elements effectively contained in the active range" to exclude anything outside the node you called execCommand() on.

While I'm at it, it might make sense to fix bug 13911.

This should be flagged prominently as a new unimplemented feature, so that implementers should be sure to critique the design if they don't completely like it.