每当我尝试从 Greasemonkey 创建一个对话框时,我都会遇到这个尴尬的错误......我相信这与 XPCNativeWrapper https://developer.mozilla.org/en/XPCNativeWrapper#Limitations_of_XPCNativeWrapper的限制有关 ,尽管我是不是100%确定。
我使用的核心 jQuery 方法都没有导致错误(append、css、submit、keydown、each、...)。
这可能是 Greasemonkey 中的错误,或者是由于 Greasemonkey 和 jquery ui 之间的交互,但我真的很想弄清楚如何让它们一起工作。
// ==UserScript==
// @name Dialog Test
// @namespace http://strd6.com
// @description jquery-ui-1.6rc6 Dialog Test
// @include *
//
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js
// @require http://strd6.com/stuff/jqui/jquery-ui-personalized-1.6rc6.min.js
// ==/UserScript==
$(document).ready(function() {
$('<div title="Test">SomeText</div>').dialog();
});
错误:[异常...“组件不可用”nsresult:“0x80040111(NS_ERROR_NOT_AVAILABLE)”位置:“JS 框架 :: file:///home/daniel/.mozilla/firefox/.../components/greasemonkey. js :: 匿名 :: 第 347 行”数据:否] [打破此错误] if (line) {
Firefox 版本:Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6
更新:标准 jQuery 库中的 focus() 方法也会抛出相同的错误:
$('body').focus();
也许 UI 在某个时候调用了 focus 方法?
任何帮助将不胜感激!