Class: Dommy::Internal::MutationCoordinator
- Inherits:
-
Object
- Object
- Dommy::Internal::MutationCoordinator
- Defined in:
- lib/dommy/internal/mutation_coordinator.rb
Overview
Coordinates mutation notification to observers and custom element lifecycle callbacks. Isolates mutation observation and custom element logic from Document's public API.
Constant Summary collapse
- BLANK_IFRAME_SRCS =
A srcless ("blank"/about:blank)
<iframe>connected to the document gets an empty nested browsing context (a real, complete content document) and fires itsloadevent ASYNCHRONOUSLY (a microtask), like a real browser — handlers are commonly attached after insertion (`appendChild(f); f.onload…`). Without this, code that awaits a blank iframe's load and then reads
iframe.contentWindow.documenthangs: FingerprintJS'swithIframe(its font sources) does exactly that, which hung note.com's tracking plugin and its whole Nuxt hydration. Asrciframe is left to the integration layer. ["", "about:blank"].freeze
Instance Method Summary collapse
-
#ensure_blank_content_document(element) ⇒ Object
Give a blank iframe a fresh empty document (or its
srcdoc) socontentWindow/contentDocumentresolve and DOM ops + measurement inside it work (readyState defaults to "complete"). - #fire_blank_iframe_load(element) ⇒ Object
-
#initialize(document, observer_manager) ⇒ MutationCoordinator
constructor
A new instance of MutationCoordinator.
- #notify_attribute_changed(element, name, old_value, new_value, namespace = nil) ⇒ Object
-
#notify_attribute_mutation(target_node:, attribute_name:, old_value:, namespace: nil) ⇒ Object
Fire MutationObserver attribute records.
-
#notify_character_data_mutation(target_node:, old_value:) ⇒ Object
Fire MutationObserver characterData records.
-
#notify_child_list_mutation(target_node:, added_nodes:, removed_nodes:, previous_sibling: nil, next_sibling: nil) ⇒ Object
Fire MutationObserver childList records.
-
#notify_connected(element) ⇒ Object
Fire CustomElement lifecycle: connected (synchronous, before mutation delivery).
-
#notify_connected_subtree(nk) ⇒ Object
Walk a subtree and fire connected/disconnected callbacks for all elements.
- #notify_disconnected(element) ⇒ Object
- #notify_disconnected_subtree(nk) ⇒ Object
- #register_observer(observer) ⇒ Object
-
#run_connected_script(element) ⇒ Object
A classic