Commit 9fc8d80e 9fc8d80e95326a878bc08c20c56eb3ea3f4e74e0 by Nicolas Perriault

page.initialized event now use native phantomjs onInitialized event

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