-
Notifications
You must be signed in to change notification settings - Fork 13.3k
cannot set element.style.cssProperty to nullΒ #60380
Copy link
Copy link
Closed as not planned
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
π Search Terms
style css property null CSSStyleDeclaration
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about "style css property null CSSStyleDeclaration".
β― Playground Link
π» Code
document.body.style.backgroundColor = null;π Actual behavior
Errors in code
Type 'null' is not assignable to type 'string'.
π Expected behavior
No error is expected.
Additional information about the issue
This can be fixed by updating the lib.dom.d.ts as follows:
interface CSSStyleDeclaration {
// ...
- backgroundColor: string;
+ get backgroundColor(): string;
+ set backgroundColor(value: string|null);
// ...
}Same change has to applied to other CSS properties.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug