FIX: fails gracefully if :scope is not handled by a browser (#9529)

This commit is contained in:
Joffrey JAFFEUX 2020-04-23 16:50:30 +02:00 committed by GitHub
parent 7a2e8d3ead
commit be1b7f7468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,9 +113,15 @@ export default {
return;
}
const commands = postElements[0].querySelectorAll(
":scope > pre > code, :scope :not(article):not(blockquote) > pre > code"
);
let commands = [];
try {
commands = postElements[0].querySelectorAll(
":scope > pre > code, :scope :not(article):not(blockquote) > pre > code"
);
} catch (e) {
// :scope is probably not supported by this browser
commands = [];
}
const post = helper.getModel();