Commit 9fc8d80e 9fc8d80e95326a878bc08c20c56eb3ea3f4e74e0 by Nicolas Perriault

page.initialized event now use native phantomjs onInitialized event

1 parent 3fe2d985
......@@ -4,6 +4,7 @@ CasperJS Changelog
2012-XX-XX, v0.6.6
------------------
- **BC BREAK:**: moved the `page.initialized` event to where it should have always been, and is now using native phantomjs `onInitialized` event
- fixed [#95](https://github.com/n1k0/casperjs/issues/95) - `Tester.assertSelectorExists` was broken
2012-03-28, v0.6.5
......
......@@ -890,11 +890,6 @@ Casper.prototype.start = function start(location, then) {
}
}, this.options.timeout, this);
}
this.emit('page.initialized', this);
if (utils.isFunction(this.options.onPageInitialized)) {
this.log("Post-configuring WebPage instance", "debug");
this.options.onPageInitialized.call(this, this.page);
}
if (utils.isString(location) && location.length > 0) {
return this.thenOpen(location, utils.isFunction(then) ? then : this.createStep(function(self) {
self.log("start page is loaded", "debug");
......@@ -1256,6 +1251,13 @@ function createPage(casper) {
casper.log(msg, level, "remote");
casper.emit('remote.message', msg);
};
page.onInitialized = function() {
casper.emit('page.initialized', this);
if (utils.isFunction(casper.options.onPageInitialized)) {
this.log("Post-configuring WebPage instance", "debug");
casper.options.onPageInitialized.call(casper, page);
}
};
page.onLoadStarted = function() {
casper.loadInProgress = true;
casper.resources = [];
......