As we know element.style.removeProperty(property) only remove one property at a time. So, I created a utility function for removing multiple properties at once. I extended CSSStyleDeclaration.prototype.
Code
declare global {
interface CSSStyleDeclaration {
removeProperties(...properties: Array<string>): void
}
}
CSSStyleDeclaration.prototype.removeProperties = function (...properties: Array<string>) {
for (let i = 0; i < properties.length; i++) {
/* LOGIC */
/* element.style.removeProperty(properties[i]) */
}
}
// USE CASE
document.querySelector('div').style.removeProperties('top', 'right', 'bottom', ...)
Now the main question is How do I target the element from which I have to remove properties ??