Fix bug 48180 (``menulists don't respect data attribute''), patch by Jan Varga, r=jag, a=hyatt

This commit is contained in:
disttsc%bart.nl 2000-11-29 12:47:19 +00:00
Родитель 8c42e80317
Коммит 39d6583431
1 изменённых файлов: 23 добавлений и 8 удалений

Просмотреть файл

@ -16,7 +16,7 @@
<xul:image class="menu-dropmarker"/> <xul:image class="menu-dropmarker"/>
</content> </content>
<handlers> <handlers>
<handler event="command" phase="capturing" action="if (event.target.localName == 'menuitem') { this.selectedItem = event.target; this.data = this.selectedItem.data; }"/> <handler event="command" phase="capturing" action="if (event.target.localName == 'menuitem') this.selectedItem = event.target;"/>
<handler event="create"> <handler event="create">
<![CDATA[ <![CDATA[
if (event.target.parentNode == this && this.selectedItem) { if (event.target.parentNode == this && this.selectedItem) {
@ -36,15 +36,30 @@
this.setAttribute('sizetopopup', 'true'); this.setAttribute('sizetopopup', 'true');
if (!this.value) { if (!this.value) {
var arr = this.getElementsByAttribute('selected', 'true'); var arr = this.getElementsByAttribute('selected', 'true');
if (arr.length == 1)
if (!arr.length && this.data)
arr = this.getElementsByAttribute('data', this.data);
if (arr.length)
this.selectedItem = arr[0]; this.selectedItem = arr[0];
else this.selectedIndex = 0; else
this.selectedIndex = 0;
} }
]]> ]]>
</body> </body>
</method> </method>
<property name="data" onset="this.setAttribute('data',val); return val;" <property name="data" onget="return this.getAttribute('data');">
onget="return this.getAttribute('data');"/> <setter>
<![CDATA[
var arr = this.getElementsByAttribute('data', val);
if (arr.length)
this.selectedItem = arr[0];
else
this.setAttribute('data', val);
return val;
]]>
</setter>
</property>
<property name="crop" onset="this.setAttribute('crop',val); return val;" <property name="crop" onset="this.setAttribute('crop',val); return val;"
onget="return this.getAttribute('crop');"/> onget="return this.getAttribute('crop');"/>
<property name="src" onset="this.setAttribute('src',val); return val;" <property name="src" onset="this.setAttribute('src',val); return val;"