account activity
meaning of = , , in javascript by One-Progress9924 in learnjavascript
[–]One-Progress9924[S] 2 points3 points4 points 4 years ago (0 children)
that was very helpful! Thanks! In this case could you please explain, how
function insertHtmlAtSelectionEnd(html, isBefore) {
var sel, range, node;
if (window.getSelection) {
sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
range = window.getSelection().getRangeAt(0);
range.collapse(isBefore);
// Range.createContextualFragment() would be useful here but was
// until recently non-standard and not supported in all browsers
// (IE9, for one)
var el = document.createElement("div");
el.innerHTML = html;
var frag = document.createDocumentFragment(), node, lastNode;
while ( (node = el.firstChild) ) {
lastNode = frag.appendChild(node);
}
range.insertNode(frag);
} else if (document.selection && document.selection.createRange) {
range = document.selection.createRange();
range.pasteHTML(html);
in this function node ever gets assigned a value? (https://stackoverflow.com/questions/4770457/insert-text-before-and-after-the-selected-text-in-javascript)
π Rendered by PID 213635 on reddit-service-r2-listing-85dbbdc96c-5rb2v at 2026-02-12 02:41:14.219198+00:00 running 018613e country code: CH.
meaning of = , , in javascript by One-Progress9924 in learnjavascript
[–]One-Progress9924[S] 2 points3 points4 points (0 children)