1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
content / test / data / attribution_reporting / register_impression.js [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function simulateClick(target) {
simulateClickWithButton(target, 0 /* left click */);
}
function simulateMiddleClick(target) {
simulateClickWithButton(target, 1 /* middle click */);
}
function simulateClickWithButton(target, button) {
if (typeof target === 'string')
target = document.getElementById(target);
let evt = new MouseEvent('click', {'button': button});
return target.dispatchEvent(evt);
}