зеркало из https://github.com/mozilla/gecko-dev.git
Bug 918863 - MutationObserver doesnt recognize all deleted elements, keypress is fired if keydown is canceled. r=yxl, r=kanru
This commit is contained in:
Родитель
200b1f45f3
Коммит
b644f506c1
|
@ -283,7 +283,7 @@ let FormAssistant = {
|
||||||
this._observer = new MutationObserver(function(mutations) {
|
this._observer = new MutationObserver(function(mutations) {
|
||||||
var del = [].some.call(mutations, function(m) {
|
var del = [].some.call(mutations, function(m) {
|
||||||
return [].some.call(m.removedNodes, function(n) {
|
return [].some.call(m.removedNodes, function(n) {
|
||||||
return n === element;
|
return n.contains(element);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (del && element === self.focusedElement) {
|
if (del && element === self.focusedElement) {
|
||||||
|
@ -292,8 +292,9 @@ let FormAssistant = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._observer.observe(element.parentNode, {
|
this._observer.observe(element.ownerDocument.body, {
|
||||||
childList: true
|
childList: true,
|
||||||
|
subtree: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -517,10 +518,16 @@ let FormAssistant = {
|
||||||
case "Forms:Input:SendKey":
|
case "Forms:Input:SendKey":
|
||||||
CompositionManager.endComposition('');
|
CompositionManager.endComposition('');
|
||||||
|
|
||||||
["keydown", "keypress", "keyup"].forEach(function(type) {
|
this._editing = true;
|
||||||
domWindowUtils.sendKeyEvent(type, json.keyCode, json.charCode,
|
let doKeypress = domWindowUtils.sendKeyEvent('keydown', json.keyCode,
|
||||||
json.modifiers);
|
json.charCode, json.modifiers);
|
||||||
});
|
if (doKeypress) {
|
||||||
|
domWindowUtils.sendKeyEvent('keypress', json.keyCode,
|
||||||
|
json.charCode, json.modifiers);
|
||||||
|
}
|
||||||
|
domWindowUtils.sendKeyEvent('keyup', json.keyCode,
|
||||||
|
json.charCode, json.modifiers);
|
||||||
|
this._editing = false;
|
||||||
|
|
||||||
if (json.requestId) {
|
if (json.requestId) {
|
||||||
sendAsyncMessage("Forms:SendKey:Result:OK", {
|
sendAsyncMessage("Forms:SendKey:Result:OK", {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче