minor fixes
This commit is contained in:
parent
2b79ab1ff8
commit
a43c18ff18
1 changed files with 2 additions and 2 deletions
|
@ -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>`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue