Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Extend CSSStyleDeclaration.prototype? #211

Open
timdream opened this issue Jan 28, 2015 · 0 comments
Open

Extend CSSStyleDeclaration.prototype? #211

timdream opened this issue Jan 28, 2015 · 0 comments

Comments

@timdream
Copy link

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant