Skip to content

Observer: [SPIKE] investigate iframe support #14

@mkazin

Description

@mkazin

In a Reddit post about a script failing to detect an element within a shadowroot, u/Speed43 suggested checking whether it was within an iframe.

I hadn't considered whether I could observe for selectors within an iframe but perhaps I should.

They mentioned needing to add the frame's URL in a @require, which may be prove a technical reason why it couldn't be accessed when passing in the DOM as the observationTarget. Then again, at first I didn't understand how ShadowRoot could be monitored by using Element.shadowRoot to traverse from the DOM to descendants of the ShadowRoot. It's also possible that the frame could be passed separately by the user.

Questions to answer:

  1. Are an iframe's descendants monitored by a MutationObserver observing its containing DOM?
  2. If not, can ObserverTracker set up a separate MutationObserver for an iframe in some manner similar to how I solved the ShadowRoot implementation?
  3. If not, can users use a second ObserverTracker to observe the DOM within an iframe, so I can at least document that as a usage scenario?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions