* Set up the single global MutationObserver and delegated input/change * listeners that power attribute, property, and query tracking.
()
| 342 | * listeners that power attribute, property, and query tracking. |
| 343 | */ |
| 344 | _initGlobalObserver() { |
| 345 | if (typeof document === "undefined") return; |
| 346 | |
| 347 | if (!this._observer) { |
| 348 | var reactivity = this; |
| 349 | this._observer = new MutationObserver(function (mutations) { |
| 350 | reactivity._handleMutations(mutations); |
| 351 | }); |
| 352 | this._inputHandler = function (e) { reactivity._handleDOMEvent(e); }; |
| 353 | this._changeHandler = function (e) { reactivity._handleDOMEvent(e); }; |
| 354 | } |
| 355 | |
| 356 | // observe() replaces any prior observation on this target |
| 357 | this._observer.observe(document, { |
| 358 | attributes: true, |
| 359 | childList: true, |
| 360 | subtree: true |
| 361 | }); |
| 362 | |
| 363 | // addEventListener is idempotent for the same listener+capture combo |
| 364 | document.addEventListener("input", this._inputHandler, true); |
| 365 | document.addEventListener("change", this._changeHandler, true); |
| 366 | } |
| 367 | |
| 368 | /** |
| 369 | * Handle MutationObserver callbacks. Dispatches to attribute and query |
no test coverage detected