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

The "typeof element.oninput" changes with Zone.js (object vs. function) #540

Closed
mkdynamic opened this issue Dec 13, 2016 · 1 comment
Closed

Comments

@mkdynamic
Copy link

Test case to reproduce:

<!DOCTYPE html>
<html>
  <body>
    <script>
      var test = function() {
        var input = document.createElement("input");
        input.setAttribute("oninput", "return");
        return typeof input.oninput;
      };

      document.write("<div>before zone.js: " + test() + "</div>");
    </script>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.7.2/zone.min.js"></script>

    <script>
      document.write("<div>after zone.js: " + test() + "</div>");
    </script>
  </body>
</html>

This outputs the following:

before zone.js: function
after zone.js: object

This breaks Modernizr’s feature detection for "oninput" (it assumed a function type):
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/event/oninput.js#L29

@JiaLiPassion
Copy link
Collaborator

after zone.js, the function become object because it will be null.
I found the same issue in #525, and I found a solution recently, I'll make a PR to fix it.

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

2 participants