Skip to content

Commit

Permalink
fix: strict types domUtils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Dec 27, 2023
1 parent f45cbd1 commit 3a963d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/dom/domUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export const applyNumericalStyle = (elem, property, value) => {
value = parseInt(value)
}
if (value || parseInt(value) === 0) {
elem.style[property] = typeof value === 'number' ? `${value}px` : value
elem.style.setProperty(property, typeof value === 'number' ? `${value}px` : value)
} else {
elem.style.removeProperty(property)
}
Expand Down Expand Up @@ -237,10 +237,10 @@ export const showWhenInnerHtmlPresent = (elem, display = 'block') => {
* @param {string} value
*/
export const setStyle = (parent, selector, property, value) => {
/** @type {HTMLElement} */
/** @type {HTMLElement | null} */
const el = parent.querySelector(selector)
if (el) {
el.style[property] = value
el.style.setProperty(property, value)
}
}

Expand Down

0 comments on commit 3a963d4

Please sign in to comment.