Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

onload event not fired for stylesheets #12332

Closed
Artur- opened this issue Jun 24, 2014 · 8 comments
Closed

onload event not fired for stylesheets #12332

Artur- opened this issue Jun 24, 2014 · 8 comments
Labels

Comments

@Artur-
Copy link
Contributor

Artur- commented Jun 24, 2014

var page = require('webpage').create();

var f = function() { console.log("done"); phantom.exit();};                    
page.onConsoleMessage = function(msg) {
  console.log('Console: ' + msg);
};
page.open("http://localhost:8888/onloadtest.html", f);

should output

Console: LOADED
done

when onloadtest.html is

<html>
<head>
<link type="text/css" rel="stylesheet" href="http://localhost:8888/styles.css" onload="console.log('LOADED');"/>
<body>
Hello
</body>
</html>

Instead, the output is only

done
@call-a3
Copy link

call-a3 commented Jan 13, 2015

Pushing this because I also need it.
I found previously closed issues stating that this is not a bug in phantomjs because webkit didn't support the onload event, but now that it does this should really also be included in phantomjs.

@pmorch
Copy link

pmorch commented Jul 8, 2015

The really bad part about this lack of support is that it is sort-of supported and it therefore isn't possible to detect lack of onload support for <link> tags using a very popular approach, apparently used by jQuery, Prototype.js, Modernizr. Basically the problem is that:

> 'onload' in document.createElement('link');
true

Please either fix onload support or remove the onload key from link elements so that lack of support is detectable.

@mildfuzz
Copy link

Is there a work around for this? Waiting for CSS to load is a great way to ensure injected JS applications look good at launch.

@mildfuzz
Copy link

the only solution I have found is to use slimerjs instead

@gurdiga
Copy link

gurdiga commented Jun 27, 2016

+1

@sumbach
Copy link

sumbach commented Sep 10, 2016

I observe the same behavior (onload callback not executed for <link> elements) with PhantomJS 1.9.8 on Ubuntu 12.04.5.

This seems to have been resolved in a subsequent release: onload is executed as expected with PhantomJS 2.1.1 on Ubuntu 12.04.5 and OSX 10.11.6 El Capitan.

@sumbach
Copy link

sumbach commented Sep 10, 2016

Is this a duplicate of #11721?

@stale stale bot added the stale label Dec 26, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants