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

IE6-8 不支持Object.keys Array.forEach #20

Open
iceman1212 opened this issue Jan 9, 2015 · 14 comments
Open

IE6-8 不支持Object.keys Array.forEach #20

iceman1212 opened this issue Jan 9, 2015 · 14 comments

Comments

@iceman1212
Copy link

copy了ieBetter.js的部分代码解决了此问题
https://github.com/zhangxinxu/ieBetter.js/blob/master/ieBetter.js
https://github.com/zhangxinxu/ieBetter.js

if (!Object.keys) {
    Object.keys = function(o) {
        if (o !== Object(o)) {
            throw new TypeError('Object.keys called on a non-object');
        }
        var k=[], p;
        for (p in o) {
            if (Object.prototype.hasOwnProperty.call(o,p)) {
                k.push(p);
            }
        }
        return k;
    };
}

  if (typeof Array.prototype.forEach != "function") {
    Array.prototype.forEach = function (fn, scope) {
        var i, len;
        for (i = 0, len = this.length; i < len; ++i) {
            if (i in this) {
                fn.call(scope, this[i], i, this);
            }
        }
           };
}
@afc163
Copy link
Member

afc163 commented Jan 9, 2015

这个组件是被改乱了,现在也没人负责。唉

@iceman1212
Copy link
Author

aralejs 组件 都没人负责吗?
我还想在项目中使用呢

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

@popomore

@army8735
Copy link
Member

army8735 commented Jan 9, 2015

感觉是时候推出es6版本了。

@popomore
Copy link
Member

popomore commented Jan 9, 2015

稳定版没有啊,master 那个 commit 要不要回滚啊,不要的话 @army8735 改改吧

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

@popomore
Copy link
Member

popomore commented Jan 9, 2015

也没问题

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

话说 chair 里线上用的到底是哪个版本啊?现在的版本明显会报错啊

@popomore
Copy link
Member

popomore commented Jan 9, 2015

1.2.0 吧,哪行代码会报错?

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

forEach ?

@popomore
Copy link
Member

popomore commented Jan 9, 2015

没搜到 forEach 的代码

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

Object.keys(proto).forEach(function(key) {

@popomore
Copy link
Member

popomore commented Jan 9, 2015

上面不是说了么,这个是 master,不是稳定版

@afc163
Copy link
Member

afc163 commented Jan 9, 2015

原来是这个改动有问题:7fd77c1

我以为是之前的遗留问题。这个 commit 修改掉吧。

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

4 participants