mirror of
https://github.com/servo/servo.git
synced 2025-06-23 16:44:33 +01:00
129 lines
No EOL
3 KiB
HTML
129 lines
No EOL
3 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
<meta charset="UTF-8" />
|
|
<title>CSS Regions: mouse events don't trigger for region children</title>
|
|
<link href="mailto:mibalan@adobe.com" rel="author" title="Mihai Balan" />
|
|
<link href="http://www.w3.org/TR/css3-regions/#the-flow-into-property" rel="help" />
|
|
<link href="http://www.w3.org/TR/css3-regions/#flow-from" rel="help" />
|
|
<meta content="Children of regions (elements with flow-from) are removed from the document flow and JavaScript event handlers set on them should not fire" name="assert" />
|
|
<meta content="dom interact" name="flags" />
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
p {
|
|
margin: 0;
|
|
}
|
|
.box {
|
|
width: 200px;
|
|
height: 200px;
|
|
float: left;
|
|
margin: 20px;
|
|
}
|
|
#source {
|
|
background-color: lightcyan;
|
|
}
|
|
#source p {
|
|
width: 100%;
|
|
height: 100px;
|
|
background-color: green;
|
|
flow-into: flow;
|
|
}
|
|
#region {
|
|
background-color: yellow;
|
|
flow-from: flow;
|
|
}
|
|
#region p {
|
|
margin-top: 100px;
|
|
width: 100%;
|
|
height: 100px;
|
|
background-color: red;
|
|
}
|
|
#result {
|
|
clear: both;
|
|
font-weight: bold;
|
|
}
|
|
.pass {
|
|
color: green;
|
|
}
|
|
.fail {
|
|
color: red;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<ol>
|
|
<li>Mouse over the green rectangle and click</li>
|
|
<li>Mouse over the yellow rectangle and click</li>
|
|
<li>You should see "PASS" appearing below</li>
|
|
<li>You should not see any red, or the word "FAIL"</li>
|
|
</ol>
|
|
<div class="box" id="source">
|
|
<p></p>
|
|
</div>
|
|
<div class="box" id="region">
|
|
<p></p>
|
|
</div>
|
|
<div class="" id="result"></div>
|
|
<script type="text/javascript">
|
|
var contentCalls = 0,
|
|
regionCalls = false;
|
|
|
|
function setResult(value) {
|
|
var tag = document.querySelector("#result");
|
|
tag.innerHTML = value;
|
|
tag.classList.add(value.toLowerCase());
|
|
}
|
|
|
|
function contentEventHandler(evt) {
|
|
contentCalls++;
|
|
|
|
if (contentCalls == 3) {
|
|
setResult("PASS");
|
|
finishTest();
|
|
}
|
|
}
|
|
|
|
function regionChildEventHandler(evt) {
|
|
regionCalls = true;
|
|
setResult("FAIL");
|
|
finishTest();
|
|
}
|
|
|
|
function finishTest() {
|
|
if (window.testRunner) {
|
|
testRunner.notifyDone();
|
|
}
|
|
}
|
|
|
|
function runScriptedTest() {
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
|
|
var boxLocation = document.querySelector("#region").getBoundingClientRect();
|
|
eventSender.mouseMoveTo(boxLocation.left + 40, boxLocation.top + 50);
|
|
eventSender.mouseDown();
|
|
eventSender.mouseUp();
|
|
|
|
eventSender.mouseMoveTo(boxLocation.left + boxLocation.width - 40, boxLocation.top + boxLocation.height - 40);
|
|
eventSender.mouseDown();
|
|
eventSender.mouseUp();
|
|
}
|
|
}
|
|
|
|
var events = [ "mouseover", "mouseout", "click" ],
|
|
regionChild = document.querySelector("#region p"),
|
|
content = document.querySelector("#source p");
|
|
|
|
events.forEach(function(item) {
|
|
regionChild.addEventListener(item, regionChildEventHandler);
|
|
content.addEventListener(item, contentEventHandler);
|
|
})
|
|
|
|
runScriptedTest();
|
|
</script>
|
|
|
|
|
|
</body></html> |