Skip to content

Commit

Permalink
refactor(plugins/tidy-html): remove else blocks after throw (#1322)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Mar 14, 2023
1 parent 8d02b89 commit b1af9bd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/plugins/tidy-html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ async function plugin(server) {

// Set document language if valid IANA language tag and subtag
const language = options?.language || "en";
if (check(language)) {
const innerHtml = dom.window.document.querySelector("html");
innerHtml.setAttribute("lang", language);
innerHtml.setAttribute("xml:lang", language);
} else {
if (!check(language)) {
throw server.httpErrors.badRequest(
"querystring.language not a valid IANA language tag"
);
}
const innerHtml = dom.window.document.querySelector("html");
innerHtml.setAttribute("lang", language);
innerHtml.setAttribute("xml:lang", language);

/**
* When an alt attribute is not present in an <img> tag, screen readers may announce the image's file name instead.
Expand Down

0 comments on commit b1af9bd

Please sign in to comment.