Only catch the correct exception

This commit is contained in:
Luca Benci 2017-10-25 22:43:17 +02:00
parent 3fd7fb3e14
commit ae2dad7d18

View File

@ -53,7 +53,9 @@ window._qutebrowser.webelem = (function() {
try {
caret_position = elem.selectionStart;
} catch (e) {
// nothing to do, caret_position is already 0
if (e instanceof DOMException && e.name === "InvalidStateError") {
// nothing to do, caret_position is already 0
}
}
var out = {