Firefox addon XUL文本框的自定义onsynctopreference

Firefox addon XUL文本框的自定义onsynctopreference,firefox-addon,xul,Firefox Addon,Xul,我想在Firefox扩展中启用自定义快捷方式。其思想是用户只需关注文本框,按下组合键,文本框就会显示出来,并保存到首选项中。然而,我无法让它工作。用这个XUL <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="tex

我想在Firefox扩展中启用自定义快捷方式。其思想是用户只需关注文本框,按下组合键,文本框就会显示出来,并保存到首选项中。然而,我无法让它工作。用这个XUL

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mozapps/skin/pref/pref.css" type="text/css"?>

<!DOCTYPE window SYSTEM "chrome://nextplease/locale/nextplease.dtd">
<prefwindow id="nextpleaseprefs" title="&options.title;" buttons="accept, cancel"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

    <prefpane id="nextplease.general" label="&options.general.title;" image="chrome://nextplease/skin/Sound Mixer.png">
        <preferences>
            <preference id="nextkey" name="nextplease.nextkey" type="int"/>
        </preferences>
        <vbox flex="1">
            <hbox align="center">
                <label value="&options.general.nextKey;" />
                <textbox id="nextkey" flex="1" editable="false" 
                         onkeyup="return nextplease.handleKeySelection(this, event);" 
                         preference-editable="true" preference="nextkey" 
                         onsynctopreference="alert('syncing'); return nextplease.syncKeySelector(this);"/>
            </hbox>
        </vbox>
    </prefpane>

    <script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseCommon.js" />
    <script type="application/x-javascript" src="chrome://nextplease/content/nextpleaseOptions.js" />
</prefwindow>


onkeyup
中的事件起作用。但是当我点击OK按钮时,我没有看到“同步”警报。为什么同步首选项上的
不起作用?是否无法为文本框设置自定义
onsynctopreference
属性

问题似乎只是偏好仅在
输入
事件(可能还有其他一些事件)上同步,而不是在
键控
上同步。问题似乎只是偏好仅在
输入
事件(可能还有其他一些事件)上同步,而不是在
键控
上同步,对吗,prefs系统通过监听“命令”、“选择”(仅限)、“更改”、“输入”事件来检测与pref相对应的元素的更改。你可以手动发射一枚。(刚才看到它在这个MDC页面上这样说:)对,prefs系统通过监听“command”、“select”(仅适用)、“change”、“input”事件来检测与pref对应的元素的更改。你可以手动发射一枚。(刚刚看到MDC页面上写着:)