主题: Opera中的致命问题
作者: sadasdad, 发布日期: 2012-07-24 00:50:05, 浏览数: 2577

操作系统:
WIN7
浏览器版本: 
Opera 11.64
KindEditor版本:
4.12
BUG再现步骤:
1.$(".articletitle").live('click',function(){
            var url=$(this).attr('href');
            var id=$(this).parent("td").prev().children().val();
           
            var area;
            if($.browser.safari){area=['600px','490px'];
            }else{
                if($.browser.version>=9)
                    area=['600px','492px'];
                else
                    area=['600px','525px'];
                }
            $.layer({ //弹出层插件    
                    v_dom:"#addtable",
                    v_box:1,
                    v_title:"编辑菜单",
                    v_btns:0,
                    v_area:area,
                    v_offset:['3%','50%'],
                    v_shade:false
            }); 
             
            if(editor){
                editor.remove('#editor');//opera报错如下
            }
            editor = KindEditor.create('#editor',{      
                height : "180px",       
                filterMode : false,
                resizeType : 0,
                shadowMode:true,
                items : [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                    'insertunorderedlist', '|', 'emoticons', 'image', 'link']
               
            });           
            $.get(url,function(data){renderform(data,id,editor);});//ajax结束
            return false;
        });  

 

/******************报错结果*****************************/


Event thread: click
Uncaught exception: TypeError: Cannot convert 'K(doc.body)' to object
Error thrown at line 3672, column 2 in <anonymous function: remove>() in http://../editor/kindeditor.js:
    K(doc.body).unbind();
called from line 5036, column 2 in <anonymous function: remove>() in http://../editor/kindeditor.js:
    self.edit.remove();
called from line 88, column 16 in <anonymous function>() in http://..Public/js/article.js:
    editor.remove('#editor');
called via Function.prototype.apply() from line 3331, column 5 in <anonymous function: dispatch>(event) in http://localhost/ashim/Admin/Tpl/Public/js/jquery.js:
    ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
called from line 2940, column 4 in <anonymous function: eventHandle>(e) in http://localhost/ashim/Admin/Tpl/Public/js/jquery.js:
    return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
/***********************************************************************/

 

bug表现为,我只能点击一次,成功弹出层,第二次因为错误,则无法成功的弹出层

 期望结果: 解决我所述问题,我猜想是remove()与opero不兼容?

作者: Roddy, 发布日期: 2012-07-24 11:35:16
你的写法好像有问题,editor.remove();后应该加editor = null;,还有editor.remove是不需要传入expr参数的。
回复
作者: sadasdad, 发布日期: 2012-07-24 12:58:20
回复Roddy:其实我也知道我这个是错误的写法,我在原本的代码里也改了的,帖上来的是没有改的,不好意思,但因为还是一样的报错,对问题没有解决作用,所以我就懒得改了
回复
发表新帖 发表回复