Skip to content

HTMLElement.style defined as readonly when it is mutable #13466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kg opened this issue Jan 13, 2017 · 1 comment
Closed

HTMLElement.style defined as readonly when it is mutable #13466

kg opened this issue Jan 13, 2017 · 1 comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@kg
Copy link

kg commented Jan 13, 2017

TypeScript Version: 2.1.5
Code

var elt = document.createElement("div");
elt.style = "test";

Expected behavior:
Should compile and run

Actual behavior:
Typescript compiler rejects the assignment to style as invalid.
According to MDN this is a valid assignment, and it works in every modern browser. The value returned by .style is readonly, but the property itself is not.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 13, 2017

Base on the spec: https://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle, style is readonly.

@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jan 13, 2017
@mhegazy mhegazy closed this as completed Apr 21, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants