Uncaught TypeError:Object#< HTMLLIElement> Chrome中没有方法“查找” [英] Uncaught TypeError: Object #<HTMLLIElement> has no method 'find' in Chrome
问题描述
以下是对我的问题的讨论: http://chat.stackoverflow.com/rooms/17/conversation/tabs-issue 我正在做以下工作: 这个错误只发生在这个函数的第二个加载中。并且它失败了 以下是堆栈跟踪: 我使用 在 这可能会帮助更好的程序员解决问题: 过去一周,我在自己编写的一个JS页面生成器接口上发现了这个错误(没有TinyMCE,只有大量的jQuery插件)。我们得出了和这张票的作者相同的结论,也就是说,jQuery错误地在一个普通的DOM元素上调用了find()。 有趣的是,当您关闭Chrome调试器时问题就消失了(我相信我们都可以欣赏那种讽刺性的东西e。) 我知道这不会让您更接近解决方案,但至少您可以放心,99.9%的用户(除非他们来自StackOverflow我想)可能永远不会看到这个问题。 Might be related to : Uncaught TypeError: Object #<HTMLLIElement> has no method 'find' Here is a chat of the discussion of my problem: http://chat.stackoverflow.com/rooms/17/conversation/tabs-issue I am doing the following: This whole error only happens on second load of this function. And it fails by the line Here is the stack trace: I am using What is returned in the
This may help better programmers than me zero in on a solution: I've been noticing this error for the past week on a JS page-builder interface that I wrote myself. (No TinyMCE, but tons of jQuery plugins.) I've come to the same conclusions as the author of this ticket, i.e., jQuery is erroneously calling find() on a plain DOM element. The interesting thing is that the problem goes away when you close the Chrome Debugger. (I'm sure we can all appreciate the irony of that one.) I know that that doesn't bring you any closer to a solution, but at least you can rest assured that 99.9% of your users (unless they're coming from StackOverflow I suppose) will probably never see this problem. 这篇关于Uncaught TypeError:Object#< HTMLLIElement> Chrome中没有方法“查找”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
它通过这里继续: http://chat.stackoverflow.com/transcript/message/4373231#4373231
<$ p $($)$ $ $(this).addClass(active);
$(document).on({
click:function(){
$ (.TaskRow)。not(this).removeClass(active)。removeClass(hoverActive);
$(。TaskDetails)。hide();
$(document) .off(keyup,body,keyDownFn);
keyDownFn = makeRelationships(this);
$(document).on(keyup,body,keyDownFn);
var thisTaskDetails =.task+ $(this).data(id)+Details;
if(detailsArray [thisTaskDetails]!== undefine d){
detailsArray [thisTaskDetails] .show();
var td = $(。taskDetails,detailsArray [thisTaskDetails]);
if($(。hide,detailsArray [thisTaskDetails])。length){
toggleMCE(td,$(。taskCopy,detailsArray [thisTaskDetails]))
$( #+ td.attr(id)+_parent,detailsArray [thisTaskDetails])。show();
}
} else {
var thisID = $(this).data(id),
displayTask = function(){
$ .get(WEBROOT + INDEX +/ Task / displayTask /+ thisID,函数(data){
var domElement = $(data),
saveThis = function(){
$(form, domElement).trigger(submit);
返回true;
},
taskDetails = $(。taskDetailsArea,domElement);
console.log (domElement);
detailsArray [thisTaskDetails] = domElement.appendTo(bottomLeftPane);
detailsArray [thisTaskDetails] .tabs(); //错误信息
console.log(domElement,detailsArray);
// *
taskDetails.tinymce({
// TinyMCE脚本的位置
script_url:INDEX +'/js/tiny_mce/tiny_mce.js',
//常规选项
主题:高级,
插件:自动链接,列表,分页,风格,层,表,保存,advhr,advimage,advlink,情绪,iespell,inlinepopups,insertdatetime,预览,searchreplace,打印,contextmenu,粘贴,方向性,全屏,不可编辑,visualchars,nonbreaking,xhtmlxtras,模板,advlist,
//主题选项
theme_advanced_buttons1:save,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,
theme_advanced_buttons2:pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,| undo,redo,| insertdate,inserttime,preview,|,forecolor,backcolor ,
theme_advanced_buttons3:tablecontrols,|,hr,removefor mat,visualaid,|,sub,sup,|,ltr,rtl,|,fullscreen,
theme_advanced_toolbar_location:top,
theme_advanced_toolbar_align:left,
theme_advanced_statusbar_location:bottom ,
theme_advanced_resizing:true,
//储蓄:
save_enablewhendirty:true,
save_onsavecallback:saveThis,
// width:$ (#leftPane)。width(),height:$(#leftPane)。height(),
//设置:
setup:function(ed){
console.log(ed,setup);
ed.onChange.add(function(ed){// blur
console.log('Editor was changed:'+ ed.id);
saveThis();
// toggleMCE(taskDetails,$(。taskCopy,domElement));
});
ed.onClick.add(function(ed,evt){// focus
console.log('Editor was clicked:'+ ed.id,evt);
});
}
});
$(form,domElement).on(submit,function(e){
e.preventDefault();
var posts = $(this)。 ();
$ .post(WEBROOT + INDEX +/ Task / changeSomething,posts);
return false;
});
$(form,domElement).on(focus,function(e){
e.preventDefault();
console.log(focus on body,e) ;
返回false;
});
// * /
});
};
if(thisID!== undefined){
displayTask();
} else {
}
}
}
},.TaskRow);
detailsArray [thisTaskDetails] .tabs();
Uncaught TypeError:Object#< HTMLLIElement>没有方法'find'jquery.js:2
e.fn.e.init jquery.js:2
e jquery.js:2
(匿名函数)jquery-ui-1.8。 9.custom.min.js:446
e.fn.e.map jquery.js:2
e.extend.map jquery.js:2
e.fn.e.map jquery.js:2
d.widget._tabify jquery-ui-1.8.9.custom.min.js:445
d.widget._create jquery-ui-1.8.9.custom.min。 js:443
b.Widget._createWidget jquery-ui-1.8.9.custom.min.js:30
b.widget.b。(匿名函数)。(匿名函数)jquery-ui- 1.8.9.custom.min.js:28
b.widget.bridge.b.fn。(匿名函数)jquery-ui-1.8.9.custom.min.js:29
e。 extend.each jquery.js:2
e.fn.e.each jquery.js:2
b.widget.bridge.b.fn。(匿名函数)jquery-ui-1.8.9。 custom.min.js:29
$ .on.click.displayTask:2525 /#tabs-25:502
f.Callbacks.n jquery.js:2
f.Callbacks.o .fireWith jquery.js:2
w jquery.js:4
f.support.ajax.f.ajaxTransport.send.d jquery.js:4
Chrome 20 +
Aside:
$。get
中返回的内容来自php:
< div class =TaskDetails任务任务<?php echo $ task ['Task'] ['taskId']; ?>详细信息>>
< ul>
< li>< a href =#tabs-1>详情< / a>< / li>
< li>< a href =#tabs-2>用户< / a>< / li>
< li>< a href =#tabs-3> / a>< / li>
< / ul>
< div id =tabs-1style =padding:0px;身高:100%; width:100%;>
< form method =postdata-row =<?php echo $ task ['Task'] ['taskId']; ?$ gt; $>
<?php
$ details = $ task ['Task'] ['taskDetails'];
$ details = nl2br($ details);
$ details = str_replace(array(\\r \\,\\r),\\\
,$ details);
$ details = implode( ,explode(\\\
,$ details));
$ details = stripslashes($ details);
?>
< textarea id =task<?php echo $任务[ '任务'] [ '任务id']; ?> Detailsname =changedToclass =任务任务<?php echo $ task ['Task'] ['taskId']; ?> taskDetailsArea><?php echo $ details;?>< / textarea>
< div id =task< php echo $ task ['Task'] ['taskId']; >>< / div>
< input name =changedvalue =taskDetailstype =hidden />
< input name =rowvalue =<?php echo $ task ['Task'] ['taskId']; < / form>
< / div>
< div id =tabs-2class =Task task< ?php echo $ task ['Task'] ['taskId']; ?> taskUsers>
<?php echo $ task ['Task'] ['taskUsers'];?>
< / div>
< div id =tabs- 3class =任务任务<?php echo $ task ['Task'] ['taskId']; >>
< pre><?php print_r($ task);?>< / pre>
< / div>
< / div>
更多信息:
detailsArray
在开始时是一个空对象 {}
。
var thisTaskDetails = .task+ $(this).data(id)+Details;
$(this)
是一些被点击的任意DOM元素。
It continues through here: http://chat.stackoverflow.com/transcript/message/4373231#4373231
$(document).on({
"click": function () {
$(this).addClass("active");
$(".TaskRow").not(this).removeClass("active").removeClass("hoverActive");
$(".TaskDetails").hide();
$(document).off("keyup", "body", keyDownFn);
keyDownFn = makeRelationships(this);
$(document).on("keyup", "body", keyDownFn);
var thisTaskDetails = ".task" + $(this).data("id") + "Details";
if (detailsArray[thisTaskDetails] !== undefined) {
detailsArray[thisTaskDetails].show();
var td = $(".taskDetails", detailsArray[thisTaskDetails]);
if ($(".hide", detailsArray[thisTaskDetails]).length) {
toggleMCE(td, $(".taskCopy", detailsArray[thisTaskDetails]))
$("#" + td.attr("id") + "_parent", detailsArray[thisTaskDetails]).show();
}
} else {
var thisID = $(this).data("id"),
displayTask = function () {
$.get(WEBROOT + INDEX + "/Task/displayTask/" + thisID, function (data) {
var domElement = $(data),
saveThis = function () {
$("form", domElement).trigger("submit");
return true;
},
taskDetails = $(".taskDetailsArea", domElement);
console.log(domElement);
detailsArray[thisTaskDetails] = domElement.appendTo(bottomLeftPane);
detailsArray[thisTaskDetails].tabs(); //ERROR HERE
console.log(domElement, detailsArray);
//*
taskDetails.tinymce({
// Location of TinyMCE script
script_url: INDEX + '/js/tiny_mce/tiny_mce.js',
// General options
theme: "advanced",
plugins: "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,advlist",
// Theme options
theme_advanced_buttons1: "save,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2: "pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,ltr,rtl,|,fullscreen",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,
//Saving:
save_enablewhendirty: true,
save_onsavecallback: saveThis,
// width: $("#leftPane").width(), height: $("#leftPane").height(),
//Setup:
setup: function (ed) {
console.log(ed, "setup");
ed.onChange.add(function (ed) { //blur
console.log('Editor was changed: ' + ed.id);
saveThis();
// toggleMCE(taskDetails, $(".taskCopy", domElement));
});
ed.onClick.add(function (ed, evt) { //focus
console.log('Editor was clicked: ' + ed.id, evt);
});
}
});
$("form", domElement).on("submit", function (e) {
e.preventDefault();
var posts = $(this).serialize();
$.post(WEBROOT + INDEX + "/Task/changeSomething", posts);
return false;
});
$("form", domElement).on("focus", function (e) {
e.preventDefault();
console.log("focused on body", e);
return false;
});
//*/
});
};
if (thisID !== undefined) {
displayTask();
} else {
}
}
}
}, ".TaskRow");
detailsArray[thisTaskDetails].tabs();
Uncaught TypeError: Object #<HTMLLIElement> has no method 'find' jquery.js:2
e.fn.e.init jquery.js:2
e jquery.js:2
(anonymous function) jquery-ui-1.8.9.custom.min.js:446
e.fn.e.map jquery.js:2
e.extend.map jquery.js:2
e.fn.e.map jquery.js:2
d.widget._tabify jquery-ui-1.8.9.custom.min.js:445
d.widget._create jquery-ui-1.8.9.custom.min.js:443
b.Widget._createWidget jquery-ui-1.8.9.custom.min.js:30
b.widget.b.(anonymous function).(anonymous function) jquery-ui-1.8.9.custom.min.js:28
b.widget.bridge.b.fn.(anonymous function) jquery-ui-1.8.9.custom.min.js:29
e.extend.each jquery.js:2
e.fn.e.each jquery.js:2
b.widget.bridge.b.fn.(anonymous function) jquery-ui-1.8.9.custom.min.js:29
$.on.click.displayTask :2525/#tabs-25:502
f.Callbacks.n jquery.js:2
f.Callbacks.o.fireWith jquery.js:2
w jquery.js:4
f.support.ajax.f.ajaxTransport.send.d jquery.js:4
Chrome 20+
Aside:
$.get
is from php:<div class="TaskDetails Task task<?php echo $task['Task']['taskId']; ?>Details">
<ul>
<li><a href="#tabs-1">Details</a></li>
<li><a href="#tabs-2">Users</a></li>
<li><a href="#tabs-3">Array</a></li>
</ul>
<div id="tabs-1" style="padding: 0px; height: 100%; width: 100%;">
<form method="post" data-row="<?php echo $task['Task']['taskId']; ?>">
<?php
$details = $task['Task']['taskDetails'];
$details = nl2br($details);
$details = str_replace(array("\\r\\n", "\\r"), "\n", $details);
$details = implode("",explode("\n", $details));
$details = stripslashes($details);
?>
<textarea id="task<?php echo $task['Task']['taskId']; ?>Details" name="changedTo" class="Task task<?php echo $task['Task']['taskId']; ?> taskDetails taskDetailsArea"><?php echo $details; ?></textarea>
<div id="task<?php echo $task['Task']['taskId']; ?>Details" class="taskCopy"><?php echo $details; ?></div>
<input name="changed" value="taskDetails" type="hidden"/>
<input name="row" value="<?php echo $task['Task']['taskId']; ?>" type="hidden"/>
</form>
</div>
<div id="tabs-2" class="Task task<?php echo $task['Task']['taskId']; ?> taskUsers">
<?php echo $task['Task']['taskUsers']; ?>
</div>
<div id="tabs-3" class="Task task<?php echo $task['Task']['taskId']; ?>">
<pre><?php print_r($task);?></pre>
</div>
</div>
More info:
detailsArray
is an empty object {}
at the start.
var thisTaskDetails = ".task" + $(this).data("id") + "Details";
$(this)
is some arbitrary DOM element that was clicked on.