<!-- submit controls with formtarget that are validated with ENTER -->
<form target="tulip" action="dummy_page.html" method="GET">
<input name='footulip' value='footulip'>
<input type='submit' id='is2' formtarget='frame6'>
</form>
<form action="dummy_page.html" method="GET">
<input name='tulipfoobar' value='tulipfoobar'>
<input type='image' id='ii2' formtarget='frame7'>
</form>
<form action="dummy_page.html" method="GET">
<input name='tulipbar' value='tulipbar'>
<button type='submit' id='bs2' formtarget='frame8'>submit</button>
</form>
<!-- check that a which is not a submit control do not use @formtarget -->
<form target='frame9' action="dummy_page.html" method="GET">
<input id='enter' name='input' value='enter' formtarget='frame6'>
</form>
</div>
<pre id="test">
<script type="application/javascript">
var gPendingLoad = 0; // Has to be set after depending on the frames number.
function runTests()
{
// Check the target IDL attribute.
for (var i=0; i<document.forms.length; ++i) { var testValue = document.forms[i].getAttribute('target');
is(document.forms[i].target, testValue ? testValue : "", "target IDL attribute should reflect the target content attribute");
}
// We add a load event for the frames which will be called when the forms
// will be submitted. var frames = [ document.getElementById('frame1'),
document.getElementById('frame2'),
document.getElementById('frame3'),
document.getElementById('frame4'),
document.getElementById('frame5'),
document.getElementById('frame5bis'),
document.getElementById('frame6'),
document.getElementById('frame7'),
document.getElementById('frame8'),
document.getElementById('frame9'),
];
gPendingLoad = frames.length;
for (var i=0; i<frames.length; i++) {
frames[i].setAttribute('onload', "frameLoaded(this);");
}
// Submitting only the forms with a valid target.
document.forms[0].submit();
document.forms[1].submit();
/**
* We are going to focus each element before interacting with either for
* simulating the ENTER key (synthesizeKey) or a click (synthesizeMouse) or
* using .click(). This because it may be needed (ENTER) and because we want
* to have the element visible in the iframe.
*
* Focusing the first element (id='is') is launching the tests.
*/
document.getElementById('is').addEventListener('focus', function(aEvent) {
synthesizeMouse(document.getElementById('is'), 5, 5, {});
document.getElementById('ii').focus();
}, {once: true});
function frameLoaded(aFrame) {
// Check if when target is unspecified, it fallback correctly to the base
// element target attribute.
is(aFrame.contentWindow.location.href, gTestResults[aFrame.name], "the target attribute doesn't have the correct behavior");
if (--gPendingLoad == 0) {
SimpleTest.finish();
}
}
</script>
</pre>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.