cssinjs / css-vendor

Runtime vendor prefixing based on feature detection.
MIT License
66 stars 23 forks source link

Throws "Unspecified Error" inside of `supportedValue` when `content` property is used. #128

Closed swernerx closed 4 years ago

swernerx commented 5 years ago

We are using css-vendor as part of our material-ui based application. Somewhere in this application or a component we are using a CSS property content might be set. IE11 throws inside supportedValue() when trying to check the possibility to apply it. It might (correctly) be related to the fact that generated content can not be applied to the internally used p element. Probably there should be some ignore list ... or this property should be added to it, if such a list is already available.

IE11 just reports an "Unspecified error".

The issue is related to this code

el.style[property] = prefixedValue

If modified with a try-catch to ignore the error it at least works. But this might also lead to the fact that the property is not applied in the end.

try {
  el.style[property] = prefixedValue;
} catch(ex) {
  console.warn("Unable to validate supported value for CSS property: " + property + "! Error: " + ex);
}

We know that IE11 is old and actually nobody likes it. :)

For others: Our "solution" for right now is to have a local copy of css-vendor inside a node_overrides folder. Then we added this to our package.json:

"resolutions": {
  "**/css-vendor": "file:./node_overrides/css-vendor-2.0.5-ie11-fixed"
},

which is used by Yarn for overriding the install source.

kof commented 5 years ago

@AleshaOleg do we put el.style[...] code into try/catch everywhere?

AleshaOleg commented 5 years ago

@kof everywhere, except case described in this issue

AleshaOleg commented 4 years ago

Fixed in 2.0.6.

swernerx commented 4 years ago

Thanks a lot!

AleshaOleg commented 4 years ago

@swernerx you're welcome :) And thanks for the report