Skip to content

Modernize

Compare
Choose a tag to compare
@Mariusthvdb Mariusthvdb released this 19 Jun 16:06
· 48 commits to master since this release
9d7890d

What's Changed

Full Changelog: 2023010...2023.06.19

  • Removed the "use strict"; directive because strict mode is enabled by default in ECMAScript modules.
  • Replaced var declarations with let or const declarations for better scoping and to follow modern JavaScript practices.
  • Refactored the updateMoreInfo function to use for...of loops instead of for loops. This simplifies the code and makes it more readable.
  • Simplified the installStatesHook and installStateBadge functions by using optional chaining (?.) and nullish coalescing (??) operators.
  • Cleaned up the init function by using optional chaining and nullish coalescing operators.
  • Replaced the deprecated async keyword in function declarations with arrow function expressions.
  • Removed unnecessary continue statement in the maybeApplyTemplateAttributes function.
  • Removed the document parameter from the lightOrShadow function since document is already available globally.
  • Replaced string concatenation with template literals for better readability.

Assign the result of document.querySelector("home-assistant").shadowRoot.querySelector("ha-more-info-dialog").shadowRoot.querySelector("ha-dialog").getElementsByClassName("content")[0].querySelector("ha-more-info-info") to a variable to avoid repeating the same query multiple times.