prefixfree
prefixfree copied to clipboard
Extend `CSSStyleDeclaration.prototype`?
I just realized I can do this to make, for example, el.style.flex work on Safari:
if (!('flex' in document.body.style) &&
('webkitFlex' in document.body.style)) {
Object.defineProperty(CSSStyleDeclaration.prototype, 'flex', {
get: function() {
return this.webkitFlex;
},
set: function(val) {
return (this.webkitFlex = val);
}
})
}
Is it better compare to mutation observer, which change the property in another function loop?