зеркало из https://github.com/mozilla/gecko-dev.git
[XForms] item labels of select don't focus select on click. Bug 344387, patch by surkov, r=doronr+olli
This commit is contained in:
Родитель
a25cea21dd
Коммит
1de6aee3bd
|
@ -242,6 +242,8 @@
|
|||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var div = document.createElementNS(this.XHTML_NS, "div");
|
||||
div.setAttribute("anonid", "itemcontainer");
|
||||
|
||||
var input = document.createElementNS(this.XHTML_NS, "input");
|
||||
input.setAttribute("type", "checkbox");
|
||||
input.setAttribute("value", aValue);
|
||||
|
@ -250,8 +252,9 @@
|
|||
input.setAttribute("disabled", "true");
|
||||
|
||||
div.appendChild(input);
|
||||
if (aLabel)
|
||||
if (aLabel) {
|
||||
div.appendChild(aLabel.cloneNode(true));
|
||||
}
|
||||
|
||||
if (aGroup) {
|
||||
aGroup.appendChild(div);
|
||||
|
@ -326,6 +329,14 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "itemcontainer") {
|
||||
event.originalTarget.firstChild.checked =
|
||||
!event.originalTarget.firstChild.checked;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="change">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
|
@ -383,6 +394,7 @@
|
|||
<parameter name="aGroup"/>
|
||||
<body>
|
||||
var div = document.createElementNS(this.XHTML_NS, "div");
|
||||
div.setAttribute("anonid", "itemcontainer");
|
||||
|
||||
var input = document.createElementNS(this.XHTML_NS, "input");
|
||||
input.setAttribute("type", "radio");
|
||||
|
|
|
@ -276,6 +276,7 @@
|
|||
// 'description' element as container for label node.
|
||||
var description = this.ownerDocument.
|
||||
createElementNS(this.XUL_NS, "description");
|
||||
description.setAttribute("anonid", "labelcontainer");
|
||||
description.appendChild(aLabel.cloneNode(true));
|
||||
box.appendChild(description);
|
||||
}
|
||||
|
@ -354,6 +355,14 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "labelcontainer") {
|
||||
event.originalTarget.previousSibling.checked =
|
||||
!event.originalTarget.previousSibling.checked;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="command">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
|
@ -574,6 +583,7 @@
|
|||
// 'description' element as container for label node.
|
||||
var description = this.ownerDocument.
|
||||
createElementNS(this.XUL_NS, "description");
|
||||
description.setAttribute("anonid", "labelcontainer");
|
||||
description.appendChild(aLabel.cloneNode(true));
|
||||
box.appendChild(description);
|
||||
}
|
||||
|
@ -647,6 +657,13 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="click">
|
||||
if (event.originalTarget.getAttribute("anonid") == "labelcontainer") {
|
||||
this.control.selectedItem = event.originalTarget.previousSibling;
|
||||
this.updateInstanceData(true);
|
||||
}
|
||||
</handler>
|
||||
|
||||
<handler event="command">
|
||||
if (event.originalTarget.getAttribute("anonid") == "wcontrol")
|
||||
this.updateInstanceData(true);
|
||||
|
|
|
@ -478,7 +478,7 @@
|
|||
var labelText = item.labelText;
|
||||
var textNode = this.ownerDocument.createTextNode(labelText);
|
||||
|
||||
var controlitem =
|
||||
var controlitem =
|
||||
this.control.appendItem(textNode, valueText);
|
||||
|
||||
var selected = false;
|
||||
|
|
|
@ -696,11 +696,17 @@ select *|*.select-choice-content, select1 *|*.select-choice-content {
|
|||
padding-left: 10px;
|
||||
}
|
||||
|
||||
/* XXX: selectors are wrong, styles don't work (bug 351797). */
|
||||
xul|*:root select1[appearance="full"] xul|box xul|radiogroup:focus xul|radio[selected] + label,
|
||||
xul|*:root select[appearance="full"] xul|box xul|checkbox:focus + label {
|
||||
outline: 1px dotted invert;
|
||||
}
|
||||
|
||||
xul|*:root select[appearance="full"] xul|*.checkbox-label-box,
|
||||
xul|*:root select1[appearance="full"] xul|*.radio-label-box {
|
||||
display: none;
|
||||
}
|
||||
|
||||
xul|*:root select, xul|*:root select1 {
|
||||
display: -moz-box;
|
||||
margin: 2px 4px;
|
||||
|
|
Загрузка…
Ссылка в новой задаче