Skip to content
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

Serveral issues on Opera browser #411

Closed
gartz opened this issue Jan 31, 2014 · 3 comments
Closed

Serveral issues on Opera browser #411

gartz opened this issue Jan 31, 2014 · 3 comments

Comments

@gartz
Copy link

gartz commented Jan 31, 2014

I was trying to debug and help to find why the plataform isn't working on Opera browser, but I couldn't looks like somewhere when wrapping methods, it pass a undefined value, then it throw exception because there isn't a treatment for undefined value, it try to consider the undefined as an Object, and Opera don't allow to parse it.

The bug begins in ShadowDOM, file wrapper.js in this method:

 /**
   * Forwards existing methods on the native object to the wrapper methods.
   * This does not wrap any of the arguments or the return value since the
   * wrapper implementation already takes care of that.
   * @param {Array.<Function>} constructors
   * @parem {Array.<string>} names
   */
  function forwardMethodsToWrapper(constructors, names) {
    constructors.forEach(function(constructor) {
      names.forEach(function(name) {
        constructor.prototype[name] = function() {
          var w = wrapIfNeeded(this);
          return w[name].apply(w, arguments);
        };
      });
    });
  }
@gartz
Copy link
Author

gartz commented Feb 3, 2014

Ok, I'm working to fix the issues, so I have made a pull request in the HTMLImports project that add support to matchesSelector for Opera12.

googlearchive/HTMLImports#48

Another thing, to make HTMLImports work in Opera 12 you will need a shim for the requestFrameAnimation, that doesn't have native support on Opera 12:

(function () {
    var lastTime = 0;
    var vendors = ['ms', 'moz', 'webkit', 'o'];
    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
                                   || window[vendors[x]+'CancelRequestAnimationFrame'];
    }

    if (!window.requestAnimationFrame)
        window.requestAnimationFrame = function(callback, element) {
            var currTime = new Date().getTime();
            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
              timeToCall);
            lastTime = currTime + timeToCall;
            return id;
        };

    if (!window.cancelAnimationFrame)
        window.cancelAnimationFrame = function(id) {
            clearTimeout(id);
        };
})();

Soon I found other needs for Opera 12 support I will add here.

@gartz
Copy link
Author

gartz commented Feb 4, 2014

Another fix to add shadowDOM support to Opera 12: googlearchive/ShadowDOM#373

@arv
Copy link
Contributor

arv commented Feb 11, 2014

Sorry. Wont Fix.

Opera 12 is discontinued and will never get native support for web components. Our goal is to get rid of these polyfills eventually and a discontinued browser is not going to help here.

@arv arv closed this as completed Feb 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants