[Webkit-unassigned] [Bug 15256] Impossible to place an editable selection inside empty elements
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sat Aug 11 19:00:00 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=15256
David Gatwood <dgatwood at mac.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dgatwood at mac.com
--- Comment #37 from David Gatwood <dgatwood at mac.com> 2012-08-11 19:00:25 PST ---
It is also, as far as I can tell, impossible to place the insertion point *between* elements. This makes a number of interesting programmatic uses of insertHTML impossible (unwrapping nodes, for example).
For example, given an HTML block like this:
<div contentEditable="true"><div id="scratchpad"></div></div>
and code like this:
document.getElementById("scratchpad").innerHTML = "<div id=\"foo\">blah</div><div id=\"bar\">blah</div>";
var sel = window.getSelection();
sel.removeAllRanges();
var range = document.createRange();
range.setStartAfter(document.getElementById("foo"));
range.setEndAfter(document.getElementById("foo"));
sel.addRange(range);
document.execCommand("insertHTML", false, "<div id=\"baz\">-</div>");
One would expect this snippet to result in:
<div id="foo">blah</div><div id="baz">-</div><div id="bar">blah</div>
but instead, you get:
<div id="foo">blah</div><div id="bar">-blah</div>
I've tried every combination of set{Start|End}{After|Before|} that I can think of, and even things like setBaseAndExtent, modifying the selection object directly by extending it in either direction, etc. Nothing works.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list