// Make sure the target div is "clickable" by adding a click listener on it.
document.getElementById('t').addEventListener('click', function(e) {
parent.ok(true, "target was clicked on");
});
function testWithAndWithoutBodyListener(aX, aY, aExpectedId, aMsg) { var func = function(e) {
// no-op function
parent.ok(true, "body was clicked on");
};
testMouseClick(aX, aY, aExpectedId, aMsg + " without listener on body");
document.body.addEventListener("click", func);
testMouseClick(aX, aY, aExpectedId, aMsg + " with listener on body");
document.body.removeEventListener("click", func);
}
// Main tests
var mm;
function runTest() {
mm = SpecialPowers.getDOMWindowUtils(parent).physicalMillimeterInCSSPixels;
parent.ok(4*mm >= 10, "WARNING: mm " + mm + " too small in this configuration. Test results will be bogus");
// Test near the target, check it hits the target
testWithAndWithoutBodyListener(200 - 2*mm, 200 - 2*mm, "t", "basic click retargeting");
// Test on the target, check it hits the target
testWithAndWithoutBodyListener(200 + 2*mm, 200 + 2*mm, "t", "direct click");
// Test outside the target, check it hits the root
testWithAndWithoutBodyListener(40, 40, "body", "click way outside target");
function runTest2() {
// In this test, mouse event retargeting is disabled.
// Test near the target, check it hits the body
testWithAndWithoutBodyListener(200 - 2*mm, 200 - 2*mm, "body", "basic click retargeting");
// Test on the target, check it hits the target
testWithAndWithoutBodyListener(200 + 2*mm, 200 + 2*mm, "t", "direct click");
// Test outside the target, check it hits the root
testWithAndWithoutBodyListener(40, 40, "body", "click way outside target");
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.