关于jQuery source ==在窗口上的问题 [英] Question about jQuery source == on window

查看:76
本文介绍了关于jQuery source ==在窗口上的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

data: function( elem, name, data ) {
    if ( !jQuery.acceptData( elem ) ) {
        return;
    }
    elem = elem == window ? windowData : elem;

直接从jQuery源复制。

Copied directly from the jQuery source.

为什么使用 elem === window 不安全?

为什么jQuery使用类型强制 window object?

Why does jQuery use type coercion on the window object?

在IE中出现 top

It would appear that in IE there's an issue with top

top == window // true
top === window // false


推荐答案

请参阅此处了解为何选中在IE中, === 的窗口对象不安全。

See here for why checking againts the window object with === is unsafe in IE.

我认为根本原因是IE与Windows操作系统紧密结合,所以你有通过窗口引用的各种操作系统对象并且等式检查就好了。那,它只是没有正确处理全局主机对象。

I think the root cause is that IE is closely coupled with the Windows OS so you have various OS objects referenced through window and the equality check just dies. That and it just doesn't handled the global host object correctly.

这篇关于关于jQuery source ==在窗口上的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆