mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 597650 - Label controls don't apply to input controls with type="hidden". r=smaug
This commit is contained in:
parent
614c1eedc7
commit
4f5b08d3ab
@ -2574,9 +2574,8 @@ bool
|
||||
nsGenericHTMLFormElement::IsLabelable() const
|
||||
{
|
||||
// TODO: keygen should be in that list, see bug 101019.
|
||||
// TODO: NS_FORM_INPUT_HIDDEN should be removed, see bug 597650.
|
||||
uint32_t type = GetType();
|
||||
return type & NS_FORM_INPUT_ELEMENT ||
|
||||
return (type & NS_FORM_INPUT_ELEMENT && type != NS_FORM_INPUT_HIDDEN) ||
|
||||
type & NS_FORM_BUTTON_ELEMENT ||
|
||||
// type == NS_FORM_KEYGEN ||
|
||||
type == NS_FORM_OUTPUT ||
|
||||
|
@ -56,6 +56,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
|
||||
[test_input_untrusted_key_events.html]
|
||||
[test_input_url.html]
|
||||
[test_label_control_attribute.html]
|
||||
[test_label_input_controls.html]
|
||||
[test_max_attribute.html]
|
||||
skip-if = e10s
|
||||
[test_maxlength_attribute.html]
|
||||
|
@ -0,0 +1,84 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=597650
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 597650</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=597650">Mozilla Bug 597650</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<label id="l">
|
||||
<input id="h"></input>
|
||||
<input type="text" id="i"></input>
|
||||
</label>
|
||||
<label id="lh" for="h"></label>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/** Test for Bug 597650 **/
|
||||
label = document.getElementById("l");
|
||||
labelForH = document.getElementById("lh");
|
||||
inputI = document.getElementById("i");
|
||||
inputH = document.getElementById("h");
|
||||
|
||||
var labelableTypes = ["text", "search", "tel", "url", "email", "password",
|
||||
"datetime", "date", "month", "week", "time",
|
||||
"number", "range", "color", "checkbox", "radio",
|
||||
"file", "submit", "image", "reset", "button"];
|
||||
var nonLabelableTypes = ["hidden"];
|
||||
|
||||
for (var i in labelableTypes) {
|
||||
test(labelableTypes[i], true);
|
||||
}
|
||||
|
||||
for (var i in nonLabelableTypes) {
|
||||
test(nonLabelableTypes[i], false);
|
||||
}
|
||||
|
||||
function test(type, isLabelable) {
|
||||
inputH.type = type;
|
||||
if (isLabelable) {
|
||||
testControl(label, inputH, type, true);
|
||||
testControl(labelForH, inputH, type, true);
|
||||
} else {
|
||||
testControl(label, inputI, type, false);
|
||||
testControl(labelForH, undefined, type, false);
|
||||
|
||||
inputH.type = "text";
|
||||
testControl(label, inputH, "text", true);
|
||||
testControl(labelForH, inputH, "text", true);
|
||||
|
||||
inputH.type = type;
|
||||
testControl(label, inputI, type, false);
|
||||
testControl(labelForH, undefined, type, false);
|
||||
|
||||
label.removeChild(inputH);
|
||||
testControl(label, inputI, "text", true);
|
||||
|
||||
var element = document.createElement('input');
|
||||
element.type = type;
|
||||
label.insertBefore(element, inputI);
|
||||
testControl(label, inputI, "text", true);
|
||||
}
|
||||
}
|
||||
|
||||
function testControl(label, control, type, labelable) {
|
||||
if (labelable) {
|
||||
is(label.control, control, "Input controls of type " + type
|
||||
+ " should be labeled");
|
||||
} else {
|
||||
is(label.control, control, "Input controls of type " + type
|
||||
+ " should be ignored by <label>");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user