зеркало из https://github.com/mozilla/ubiquity.git
ContextUtils: Prevented setSelection() fail (Error: prefix not bound to a namespace) happens when focusedElement is xul:textbox and options.text isn't provided. Filled in a missing line that should have been there on 79c4becfe1a1.
This commit is contained in:
Родитель
1dbe81f78c
Коммит
a7602cc058
|
@ -110,12 +110,10 @@ function setSelection(context, content, options) {
|
|||
}
|
||||
|
||||
if (Utils.isTextBox(focusedElement)) {
|
||||
let plainText = options && options.text;
|
||||
if (!plainText) {
|
||||
let rng = focusedElement.ownerDocument.createRange();
|
||||
rng.selectNode(focusedElement);
|
||||
plainText = rng.createContextualFragment(content).textContent;
|
||||
}
|
||||
let plainText = String(
|
||||
options && options.text ||
|
||||
(focusedElement.ownerDocument.createRange()
|
||||
.createContextualFragment("<_>" + content + "</_>").textContent));
|
||||
focusedElement.QueryInterface(Ci.nsIDOMNSEditableElement)
|
||||
.editor.QueryInterface(Ci.nsIPlaintextEditor).insertText(plainText);
|
||||
focusedElement.selectionStart -= plainText.length;
|
||||
|
@ -176,6 +174,7 @@ function getSelectedNodes(context, selector) {
|
|||
}
|
||||
} while (node.nodeType === TEXT || range.isPointInRange(node, 0));
|
||||
}
|
||||
var flm = context.focusedElement;
|
||||
if (flm) (function run(rs, ns) {
|
||||
for (var n, i = -1; n = ns[++i];) {
|
||||
~rs.indexOf(n) || rs.push(n);
|
||||
|
|
Загрузка…
Ссылка в новой задаче