204 lines
5.1 KiB
HTML
204 lines
5.1 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title>maction toggle</title>
|
|
<script type="text/javascript">
|
|
function click(id, bubble, preventDefault)
|
|
{
|
|
var event = new MouseEvent('click', {bubbles: bubble, cancelable: true});
|
|
if (preventDefault)
|
|
event.preventDefault();
|
|
document.getElementById(id).dispatchEvent(event);
|
|
}
|
|
function test()
|
|
{
|
|
// selection=1 ; ([1] 2 3 4)
|
|
// After three clicks, selection=4: (1 2 3 [4])
|
|
click('m1'); click('m1'); click('m1');
|
|
|
|
// selection=2 ; (1 [2] 3 4)
|
|
// After one click, selection=3: (1 2 [3] 4)
|
|
click('m2');
|
|
|
|
// selection=4 ; (1 2 3 [4])
|
|
// After one click, selection=1: ([1] 2 3 4)
|
|
click('m3');
|
|
|
|
// Other edge cases
|
|
for (var i = 1; i <= 13; i++)
|
|
click('e'+i);
|
|
|
|
// Nested maction elements, bubble = false ; ([([1] 2 3)] 4 5)
|
|
// After one click on the inner maction: ([(1 [2] 3)] 4 5)
|
|
click('m4', false);
|
|
|
|
// Nested maction elements, bubble = true ; ([([1] 2 3)] 4 5)
|
|
// After one click on the inner maction: ([(1 [2] 3)] 4 5)
|
|
// Bubbling sends the event to outer maction handlers, but default handling is done only once.
|
|
click('m5', true);
|
|
|
|
// Prevent default ; ([1] 2 3)
|
|
// After one click on the inner maction: ([1] 2 3)
|
|
click('m6', false, true);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="test()">
|
|
|
|
<!-- This test verifies the effect of mouse clicks on <maction actiontype="toggle"> elements. -->
|
|
|
|
<!-- selection="1" (default) ; three clicks -->
|
|
<math>
|
|
<maction actiontype="toggle" id="m1">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
<mn>4</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- selection="2" ; one click -->
|
|
<math>
|
|
<maction actiontype="toggle" selection="2" id="m2">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
<mn>4</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- selection="4" (last child) ; one click -->
|
|
<math>
|
|
<maction actiontype="toggle" selection="4" id="m3">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
<mn>4</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- Other edge cases -->
|
|
<math>
|
|
<maction actiontype="toggle" id="e1">
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" id="e2">
|
|
<mn>1</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="-10" id="e3">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="-1" id="e4">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="0" id="e5">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="4" id="e6">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="10" id="e7">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection=" 	
2 	
" id="e8">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<maction actiontype="toggle" selection="TWO" id="e9">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
<math>
|
|
<!-- These values are limits for 32 bits signed integers.
|
|
The maction element will convert them to 1 and 3 respectively. -->
|
|
<maction actiontype="toggle" selection="-65536" id="e10">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
<maction actiontype="toggle" selection="65535" id="e11">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
<!-- These values are -1 and +1 for 32 or 64 bits signed integers.
|
|
The maction element will convert both of them to 1. -->
|
|
<maction actiontype="toggle" selection="-18446744073709551617" id="e12">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
<maction actiontype="toggle" selection="18446744073709551617" id="e13">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- Nested <maction> elements ; bubble = false -->
|
|
<math>
|
|
<maction actiontype="toggle">
|
|
<maction actiontype="toggle" id="m4">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
<mn>4</mn>
|
|
<mn>5</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- Nested <maction> elements ; bubble = true -->
|
|
<math>
|
|
<maction actiontype="toggle">
|
|
<maction actiontype="toggle" id="m5">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
<mn>4</mn>
|
|
<mn>5</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
<!-- Prevent default -->
|
|
<math>
|
|
<maction actiontype="toggle" id="m6">
|
|
<mn>1</mn>
|
|
<mn>2</mn>
|
|
<mn>3</mn>
|
|
</maction>
|
|
</math>
|
|
|
|
|
|
</body>
|
|
</html>
|