question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

elemental2.dom.Window is missing document variable

See original GitHub issue

I’m trying to access the document from a elemental2.dom.HTMLIFrameElement but noticed that elemental2.dom.Window (via HTMLIFrameElement.contentWindow) has no document variable. There is no chance to access an iframe document via elemental2.

This should be possible. Please see more details in the example at https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow

I need to solve that via native gwt code:

public final native elemental2.dom.Document document(elemental2.dom.Window contentWindow) /*-{
	return contentWindow.document;
}-*/;

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
jDramaixcommented, May 1, 2019

You are right but DomGlobal.document and DomGlobal.window are targeting the global document and window objects. The goal is to access document from any Window object that could potentially comes from an IFrame.

0reactions
jDramaixcommented, Nov 2, 2020

If you need to access the body, you can still work around this problem by using jsinterop-base:

import jsinterop.base.Js;

HTMLBodyElement iframeBody = Js.asPropertyMap(iframe.contentWindow).get("body");
iframeBody.addEventListener(...)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing DOM element - javascript - Stack Overflow
Ah, here we go: DOM Level 0. Not part of any standard. - so it works elsewhere. As I checked, the name is...
Read more >
Window - Web APIs - MDN Web Docs - Mozilla
desktop desktop Chrome Edge Window Full support. Chrome1. Toggle history Full support. Edge12. To... DOMContentLoaded event Full support. Chrome1. Toggle history Full support. Edge12. To...
Read more >
gwtproject/gwt - Gitter
getPropertyValue('--my-variable-name');. I looked at a getComputedStyle method in DomGlobal.window and DomGlobal.document but could not find it.
Read more >
Accessing Element IDs in DOM as window/global Variables
5. attach and remove event listeners to the element. <div id="so_many">So many to think about</div> <script> const so_many = document.
Read more >
Experimental release of Elemental2 - Google Groups
A new experimental version of Elemental2 using the new JsInterop specification has been pushed on Sonatype today. You can try it by downloading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found