import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1,3 @@
<form action="about:blank">
<button id="submit">Submit</button>
</form>

View file

@ -0,0 +1,17 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="button-activate-frame.html" onload="runTest()"></iframe>
<script>
var t = async_test("button activation behaviour submits form");
function runTest() {
var iframe = document.querySelector('iframe');
iframe.onload = t.step_func(function() {
t.done();
});
var doc = iframe.contentDocument;
doc.querySelector('button').click();
}
</script>

View file

@ -0,0 +1,66 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: Button - events</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-button-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<form name="fm1" style="display:none">
<button id="btn">BUTTON</button>
<button id="menu_btn" type="menu" menu="menu">MENU BUTTON</button>
<menu id="menu" label="MENU">
<li>Menu item</li>
</menu>
</form>
<script>
var btn = document.getElementById("btn"),
menu_btn = document.getElementById("menu_btn"),
t1 = async_test("The submit event must be fired when click a button in submit status"),
t2 = async_test("The reset event must be fired when click a button in reset status"),
t3 = async_test("The show event must be fired when click a button in menu status");
document.forms.fm1.onsubmit = t1.step_func(function (evt) {
evt.preventDefault();
assert_true(evt.isTrusted, "The isTrusted attribute of the submit event should be true.");
assert_true(evt.bubbles, "The bubbles attribute of the submit event should be true.");
assert_true(evt.cancelable, "The cancelable attribute of the submit event should be true.");
assert_true(evt instanceof Event, "The submit event is an instance of Event interface.");
t1.done();
});
document.forms.fm1.onreset = t2.step_func(function (evt) {
assert_true(evt.isTrusted, "The isTrusted attribute of the reset event should be true.");
assert_true(evt.bubbles, "The bubbles attribute of the reset event should be true.");
assert_true(evt.cancelable, "The cancelable attribute of the reset event should be true.");
assert_true(evt instanceof Event, "The reset event is an instance of Event interface.");
t2.done();
});
document.getElementById("menu").onshow = t3.step_func(function (evt) {
assert_true(evt.isTrusted, "The isTrusted attribute of the show event should be true.");
assert_equals(evt.relatedTarget, menu_btn, "The relatedTarget attribute should be initialized to the related button element.");
assert_true(evt.cancelable, "The cancelable attribute of the show event should be true.");
assert_true(evt instanceof RelatedEvent, "The show event is an instance of RelatedEvent interface.");
t3.done();
});
t1.step(function () {
btn.type = "submit";
assert_equals(btn.type, "submit", "The button type should be 'submit'.");
btn.click();
});
t2.step(function () {
btn.type = "reset";
assert_equals(btn.type, "reset", "The button type should be 'reset'.");
btn.click();
});
t3.step(function () {
assert_equals(menu_btn.type, "menu", "The button type should be 'menu'.");
menu_btn.click();
});
</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>button element validation</title>
<link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-button-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<button id=btn1>button</button>
<button id=btn2 type=submit>button</button>
<button id=btn3 type=reset>button</button>
<button id=btn4 type=button>button</button>
<button id=btn5 type=menu>button</button>
<button id=btn6 type=foobar>button</button>
<script>
function willValid(element, expectedType, willValidate, desc) {
test(function(){
assert_equals(element.type, expectedType);
assert_equals(element.willValidate, willValidate);
}, desc);
}
willValid(document.getElementById('btn1'), "submit", true, "missing type attribute");
willValid(document.getElementById('btn2'), "submit", true, "submit type attribute");
willValid(document.getElementById('btn3'), "reset", false, "reset type attribute");
willValid(document.getElementById('btn4'), "button", false, "button type attribute");
willValid(document.getElementById('btn5'), "menu", false, "menu type attribute");
willValid(document.getElementById('btn6'), "submit", true, "invalid type attribute");
</script>