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

Window.open method should return a Window, not a WindowBase, so the opened window's document.body can be manipulated #20407

Closed
DartBot opened this issue Aug 7, 2014 · 5 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-html

Comments

@DartBot
Copy link

DartBot commented Aug 7, 2014

This issue was originally filed by silviu...@gmail.com


What steps will reproduce the problem?

  1. Open Dart Editor;
  2. Create a web application project;
  3. Write this in the .dart file: window.open('', 'test').document.body.

What is the expected output? What do you see instead?
The editor warns me that window.open returns a WindowBase which does not have a 'document' property.

What version of the product are you using?
Dart SDK 1.5.8

On what operating system?
Ubuntu 14.04 x64

What browser (if applicable)?
N/A

Please provide any additional information below.
It is useful to be able to manipulate the body of the opened (created) window and I do not see a reason for which this browser API is not exposed.

@DartBot
Copy link
Author

DartBot commented Aug 7, 2014

This comment was originally written by @zoechi


see also
https://code.google.com/p/dart/issues/detail?id=20216

@DartBot
Copy link
Author

DartBot commented Aug 7, 2014

This comment was originally written by silviu...@gmail.com


I have found a hacky way to do what I want but I must do two unintuitive forced casts:

    Window w = window.open('', 'test') as Window;
    (w.document as HtmlDocument).body.appendHtml('<h1>Test</h1>');

I am convinced that this part of the API can be improved.

@DartBot
Copy link
Author

DartBot commented Aug 8, 2014

This comment was originally written by @zoechi


This is not hacky at all but doesn't work anymore because after a recent fix
'_DomWindowCrossFrame' is returned instead of a 'WindowBase' which doesn't allow to access to 'document' or any other method/field of 'Window'.

@sgjesse
Copy link
Contributor

sgjesse commented Aug 11, 2014

Added Area-Library, Library-Html, Triaged labels.

@vsmenon
Copy link
Member

vsmenon commented Aug 12, 2014

Added Duplicate label.
Marked as being merged into #20146.

@DartBot DartBot added Type-Defect area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-html closed-duplicate Closed in favor of an existing report labels Aug 12, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. closed-duplicate Closed in favor of an existing report library-html
Projects
None yet
Development

No branches or pull requests

4 participants