Javascript IN operator compatibility

后端 未结 2 1455
太阳男子
太阳男子 2020-11-30 10:50

Can someone tell me since which ECMA version the IN operator is available and which browsers (versions) support it ?

Explanation:

The IN-operator can be used

相关标签:
2条回答
  • 2020-11-30 11:26

    It is defined in ECMAScript 3rd edition. It is available in IE 5.5+ and all in-use versions of Firefox, Chrome, Opera and Safari.

    You can use it safe in the knowledge that it will work.

    You should err on the side of caution when using it to check event support. All implementations except older Firefox versions support "eventname" in element as a test for DOM events.

    "onclick" in document.body; // -> false in old Fx, true in others
    document.body.setAttribute("onclick", "");
    typeof(document.body.onclick == "function"); // -> true in Fx
    
    0 讨论(0)
  • 2020-11-30 11:36

    According to MDC, it's implemented in JavaScript 1.4.

    According to Wikipedia:

    • Netscape Navigator 6.0
    • Firefox 1.0+
    • IE 5.5+
    • Opera 6.0+
    • Safari 3.0+
    • Chrome 1.0+

    So I think you're probably OK :)

    0 讨论(0)
提交回复
热议问题