Consider this JavaScript snippet:
var a = document.createElement("a");
a.style.display = "none";
IntelliJ IDEA 2016.2 highlights a.style.display
and gives this hint:
Value assigned to primitive will be lost
Checks for improper usage of wrappers for JavaScript primitive types. Also, warning will be produced when property of primitive type is modified, as assigned value will be lost
CSSStyleDeclaration
is not a primitive type, thus the assignment to display
won't be lost.
String
is a wrapper type. How am I using it (improperly)?
The code seems to work fine in Chrome and Edge. What's the deal?