author Ehsan Akhgari <ehsan@mozilla.com>
Tue, 16 Nov 2010 15:45:49 -0500
changeset 97673 838fb33405ba7f8804a76528aa956b913068015c
parent 86592 018cfb14c03e95b679c793cfed1aeae941470771
permissions -rw-r--r--
Bug 612128 - Prevent the editor from modifying nodes which are not under an editing host; r=roc,bzbarsky This patch ensures that the NODE_IS_EDITABLE flag is only set on nodes living under an editing host. Things like text controls which used to have that flag previously will not have it any more. The flag would be set on their anonymous div node instead. Note that if text controls actually fall under an editing host, they will get the NODE_IS_EDITABLE flag. This patch also makes nsHTMLEditor::IsEditable return sane results (text nodes are always considered to be editable).

<!DOCTYPE html>
<html class="reftest-wait">

function boom()
  var div = document.querySelector("div");
  div.contentEditable = "true";

  var r = document.documentElement;

  setTimeout(function() {
    getSelection().collapse(div, 0);
    document.execCommand("inserthtml", false, "a");
    setTimeout(function() {
    }, 0);
  }, 0);


<body onload="boom();"><div></div></body>