Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support: understanding iframes #164

Open
gcbw opened this issue Apr 30, 2020 · 5 comments
Open

support: understanding iframes #164

gcbw opened this issue Apr 30, 2020 · 5 comments

Comments

@gcbw
Copy link

gcbw commented Apr 30, 2020

I am trying to understand why this code asserts true.

    var parentwin = domino.createWindow('<h1>parent</h1><iframe id="frm" src="http://example.com/child.html"></iframe>', 'http://example.com/parent.html');
    var window = parentwin.document.getElementById('frm')._contentWindow;
    window.location.href = 'http://example.com/child.html';

    assert.equal(window.top, window.self);

i'm running this on mocha, over node12.

debugging i can confirm that at the time of assert, both window.top and window.self shows the same object (having location.href=child.html.

what am i doing wrong here? Is there a better way to mock a window with a parent window similar to an iframe relation for a test?

@gcbw
Copy link
Author

gcbw commented Apr 30, 2020

found this test, but it doesn't touch the .top .parent properties either

iframe._contentWindow = new Window(dummyXmlDoc);

@gcbw
Copy link
Author

gcbw commented Apr 30, 2020

installed webstrom to make sure i had a decent debugger without a browser.

Screen Shot 2020-04-30 at 16 27 22

@gcbw
Copy link
Author

gcbw commented May 1, 2020

guessing there's no support for nesting. Is this something we might want to add (i assumed it was already supported because of the w3c tests)

https://github.com/fgnass/domino/blob/master/lib/Window.js#L32

@cscott
Copy link
Collaborator

cscott commented May 1, 2020

domino doesn't generally do loading, by design. If there's some useful improvements to the handling of <iframe> which doesn't involve loading content from its src, I'm certainly open to them, especially if they are standards-based.

@gcbw
Copy link
Author

gcbw commented May 1, 2020

don't care about the loading either (the test reset the location just to id them). mostly the nesting is what matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants