minor fixes

This commit is contained in:
Ilya Kantor 2020-12-15 20:17:19 +03:00
parent 2b79ab1ff8
commit a43c18ff18

View file

@ -155,7 +155,7 @@ We need to create a range, that:
range.setStart(p.firstChild, 2); range.setStart(p.firstChild, 2);
range.setEnd(p.querySelector('b').firstChild, 3); range.setEnd(p.querySelector('b').firstChild, 3);
alert(range); // ample: italic and bol console.log(range); // ample: italic and bol
// use this range for selection (explained later) // use this range for selection (explained later)
window.getSelection().addRange(range); window.getSelection().addRange(range);
@ -244,7 +244,7 @@ Click buttons to run methods on the selection, "resetExample" to reset it.
let newNode = document.createElement('u'); let newNode = document.createElement('u');
try { try {
range.surroundContents(newNode); range.surroundContents(newNode);
} catch(e) { alert(e) } } catch(e) { console.log(e) }
}, },
resetExample() { resetExample() {
p.innerHTML = `Example: <i>italic</i> and <b>bold</b>`; p.innerHTML = `Example: <i>italic</i> and <b>bold</b>`;