зеркало из https://github.com/mozilla/pjs.git
Bug 360220 - readers menulist has no icon if the last-selected reader is a web reader. r=enn.
This commit is contained in:
Родитель
986a234deb
Коммит
59ca7c5fbb
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=360220
|
||||
-->
|
||||
<window title="Mozilla Bug 360220"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<title>Test for Bug 360220</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=360220">Mozilla Bug 360220</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<menulist id="menulist">
|
||||
<menupopup>
|
||||
<menuitem id="firstItem" label="foo" selected="true"/>
|
||||
<menuitem id="secondItem" label="bar"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 360220 **/
|
||||
|
||||
var menulist = document.getElementById("menulist");
|
||||
var secondItem = document.getElementById("secondItem");
|
||||
menulist.selectedItem = secondItem;
|
||||
|
||||
ok(menulist.label == "bar", "second item was not selected");
|
||||
secondItem.label = "new label";
|
||||
ok(menulist.label == "new label", "menulist label was not updated to the label of its selected item");
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</window>
|
|
@ -47,7 +47,7 @@
|
|||
</handler>
|
||||
</handlers>
|
||||
|
||||
<implementation implements="nsIDOMXULMenuListElement, nsIAccessibleProvider">
|
||||
<implementation implements="nsIDOMXULMenuListElement, nsIAccessibleProvider, nsIDOMEventListener">
|
||||
<constructor>
|
||||
this.setInitialSelection()
|
||||
</constructor>
|
||||
|
@ -184,8 +184,10 @@
|
|||
if (val && !this.contains(val))
|
||||
return val;
|
||||
|
||||
if (oldval)
|
||||
if (oldval) {
|
||||
oldval.removeAttribute('selected');
|
||||
oldval.removeEventListener("DOMAttrModified", this, false);
|
||||
}
|
||||
|
||||
this.mSelectedInternal = val;
|
||||
if (val) {
|
||||
|
@ -194,6 +196,7 @@
|
|||
this.setAttribute('image', val.getAttribute('image'));
|
||||
this.setAttribute('label', val.getAttribute('label'));
|
||||
this.setAttribute('description', val.getAttribute('description'));
|
||||
val.addEventListener("DOMAttrModified", this, false);
|
||||
}
|
||||
else {
|
||||
this.removeAttribute('value');
|
||||
|
@ -215,6 +218,25 @@
|
|||
</setter>
|
||||
</property>
|
||||
|
||||
<method name="handleEvent">
|
||||
<parameter name="event"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (event.type == "DOMAttrModified" &&
|
||||
event.target == this.mSelectedInternal) {
|
||||
var attrName = event.attrName;
|
||||
switch (attrName) {
|
||||
case "value":
|
||||
case "label":
|
||||
case "image":
|
||||
case "description":
|
||||
this.setAttribute(attrName, event.newValue);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="appendItem">
|
||||
<parameter name="label"/>
|
||||
<parameter name="value"/>
|
||||
|
@ -294,6 +316,13 @@
|
|||
]]>
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<destructor>
|
||||
<![CDATA[
|
||||
if (this.mSelectedInternal)
|
||||
this.mSelectedInternal.removeEventListener("DOMAttrModified", this, false);
|
||||
]]>
|
||||
</destructor>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче