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

avalon1.5.2在IE8下报错: 对象不支持“hasOwnProperty”属性或方法 #1063

Closed
Lihuanghe opened this issue Sep 21, 2015 · 5 comments

Comments

@Lihuanghe
Copy link
Contributor

调用栈:
toJson [行: 1434,列: 13], avalon.js
toJson [行: 1435,列: 17], avalon.js
$modelDescriptor.get [行: 1445,列: 9], avalon.js
VBMediator [行: 1489,列: 17], avalon.js

@RubyLouvre
Copy link
Owner

给例子!一个可以运行的页面!

@Lihuanghe
Copy link
Contributor Author

这个:

http://lihuanghe.github.io/avalontest/#!/33

在调用main.js的:$(el).datagrid(vm.$model.wrapperOptions);报错:

@Lihuanghe
Copy link
Contributor Author

我找到问题原因了,我在avalonJQcomponent.js的component里增加了一个dom属性,用来保存dom元素,方便以后jquery操作。就是因为多了这个dom属性导致的问题

    //把jquery的插件包装成一个avalon的组件
    var wrapper = function(name,template,init,destroy){

            avalon.component("jq:"+name, {
                wrapperOptions:{},
                $replace: true,
               // $DOMelement:{}, //这个dom属性引起IE8的问题
                $init:function(vm,el){
                     avalon.log('init :' + vm.$id )
                },
                $ready: function (vm,el) {
                 //  vm.$DOMelement = el;
                   if(init)
                        init(vm,el);
                },
                $dispose :function(vm,el){
                     el.innerHTML =  ""
                     if(destroy)
                        destroy(vm.el);
                     avalon.log('dispose :' + vm.$id )
                },
                $template: template
            });
    }
    return {wrap:wrapper};

不知道怎么解决。

@Lihuanghe
Copy link
Contributor Author

重现错误:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="./avalon.js"></script>
<script type="text/javascript">

        var model = avalon.define({
                $id: "main",
                test:'在IE8下的组件有bug'
      });
      avalon.library("te");
    avalon.component("te:test", {
                $replace: true,
                test:'12',
                $DOMelement:{},
                $init:function(vm,el){
                     avalon.log('init :' + vm.$id )
                },
                $ready: function (vm,el) {
                   vm.$DOMelement =el;
                    avalon.log('ready :' + vm.$id )
                },
                $dispose :function(vm,el){
                     el.innerHTML =  ""
                     avalon.log('dispose :' + vm.$id )
                },
                $template: '<span>ABC</span>'
            });


     avalon.ready(function(){
        avalon.scan();
        setTimeout(function(){
          avalon.log(avalon.vmodels.test.$model.$DOMelement)  ; //这一行报错
        },500);

      });
</script>
</head>
<body class="ms-controller" ms-controller="main">
<div>
<te:test $id='test'></te:test>
</div>
</body>

</html>

@RubyLouvre
Copy link
Owner

RubyLouvre pushed a commit that referenced this issue Sep 22, 2015
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