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

nw2: window.loaded event behaves differently than it's DOM equivalent #7306

Closed
hrocha1 opened this issue Jan 7, 2020 · 4 comments
Closed
Assignees
Labels

Comments

@hrocha1
Copy link

hrocha1 commented Jan 7, 2020

NWJS Version : v0.44.0-beta1
Operating System : Windows 7

Expected behavior

The NW.js window.loaded event should work the same as it's window.onload DOM equivalent.

Actual behavior

The NW.js window.loaded event is called even if you click on something like <a href="#">test</a>, but it shouldn't ( it's DOM equivalent is not called). This problem is only present in the nw2 mode, it works as expected with --disable-features=nw2.

Code

package.json

{
  "name": "hreftest",
  "main": "main.js"
}

test.html

<html>
<head>
	<script>
	      function load() {
        	console.log("DOM onload event");
	      }

	      window.onload = load;
	</script>
</head>
<body>
	<a href="#">test</a>
</body>
</html>

main.js

nw.Window.open('test.html', {}, function(win) {
	win.on("loaded", function() {
		win.window.console.log("NW.js loaded event");
	});
});

How to reproduce

  1. Unpack the attached zip to a directory and run nw.exe against it.
    issue3.zip

  2. Click on the test link

  3. This click shouldn't produce any output in the console, but it does

@rogerwang rogerwang added the nw2 label Jan 8, 2020
@rogerwang rogerwang self-assigned this Jan 10, 2020
@rogerwang
Copy link
Member

Ref #5001

@rogerwang
Copy link
Member

This is fixed in git and will be available in the next nightly build.

@rogerwang
Copy link
Member

The nightly build for this issue is available at https://dl.nwjs.io/live-build/nw43/20200110-162000/81e6e7a59

@hrocha1
Copy link
Author

hrocha1 commented Jan 13, 2020

works for me, thanks

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

No branches or pull requests

2 participants