1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// The browser handles and the wasm-bindgen glue this module reaches
// for are only used on the wasm target, so on a host build the glob
// import resolves to nothing.
use *;
/// Schedules `callback` to run after the current render has been
/// committed to the DOM.
///
/// The element-bound hooks — the resize observer, the intersection
/// observer, the hover tracker — need the live DOM element before they
/// can subscribe to it, and the element does not exist while the first
/// render is still being built. A zero-delay timeout is used rather
/// than a microtask on purpose: the renderer commits a signal-driven
/// update in a microtask, so a microtask scheduled from inside a render
/// could run *before* that commit and would see a stale DOM. A timeout
/// is a macrotask, so it is always queued behind every pending
/// microtask and the DOM is settled by the time it runs.
///
/// On a host without a browser the callback is dropped: there is no DOM
/// to wait for, and the hooks that use this are inert there anyway.
///
/// # Arguments
///
/// - `F` - The callback to run after the DOM is committed.
pub
/// Schedules `callback` to run `delay_ms` milliseconds from now.
///
/// The callback runs as a macrotask, so it is always queued behind the
/// pending microtasks the renderer uses to commit updates.
///
/// On a host without a browser the callback is dropped.
///
/// # Arguments
///
/// - `u32` - The delay in milliseconds.
/// - `F` - The callback to run.
pub
/// Returns the browser window, or `None` on a host without one.
///
/// # Returns
///
/// - `Option<Window>` - The window, when the host has one.
pub
/// Returns the browser document, or `None` on a host without one.
///
/// # Returns
///
/// - `Option<Document>` - The document, when the host has one.
pub
/// Reports whether the node `candidate` sits inside the node `container`.
///
/// A node counts as inside itself, which is what a click-outside check
/// needs: a click on the watched element is not "outside" it.
///
/// # Arguments
///
/// - `&Node` - The node that was clicked.
///
/// # Returns
///
/// - `bool` - `true` when `candidate` is inside `container`.
pub