Post-insertion configureNode()
This commit is contained in:
parent
152a76af5e
commit
61ca89ce04
12
js/src/ui.js
12
js/src/ui.js
|
@ -352,6 +352,17 @@ function htmlToNodes(parent, html) {
|
||||||
return Array.prototype.slice.call(e.childNodes);
|
return Array.prototype.slice.call(e.childNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function configureNode(n) {
|
||||||
|
// Runs post-insertion configuration of nodes.
|
||||||
|
// TODO: review this design.
|
||||||
|
selectorMatch(n, '.-syndicate-focus').forEach(function (n) {
|
||||||
|
if ('focus' in n && 'setSelectionRange' in n) {
|
||||||
|
n.focus();
|
||||||
|
n.setSelectionRange(n.value.length, n.value.length);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
UIFragment.prototype.updateContent = function (newSelector, newHtml, newOrderBy) {
|
UIFragment.prototype.updateContent = function (newSelector, newHtml, newOrderBy) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
@ -364,6 +375,7 @@ UIFragment.prototype.updateContent = function (newSelector, newHtml, newOrderBy)
|
||||||
htmlToNodes(anchorNode, newHtml).forEach(function (newNode) {
|
htmlToNodes(anchorNode, newHtml).forEach(function (newNode) {
|
||||||
setSortKey(newNode, newOrderBy, self.fragmentId);
|
setSortKey(newNode, newOrderBy, self.fragmentId);
|
||||||
anchorNode.insertBefore(newNode, insertionPoint);
|
anchorNode.insertBefore(newNode, insertionPoint);
|
||||||
|
configureNode(newNode);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue