Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

route.js: setState called before it is defined

$
0
0

The jQuery onReady event handler gets invoked before setState is defined in IE7:

  1. $(function() {
  2. $.route.ready();
  3. });

triggering this code:

  1. ready: function(val) {
  2. if( val === false ) {
  3. onready = false;
  4. }
  5. if( val === true || onready === true ) {
  6. setState();
  7. }
  8. return $.route;
  9. },

which throws a JavaScript runtime error because setState is defined later in the file.

I tried delaying the onready event by calling $.holdReady(true) but the ready event is triggered before $.holdReady is executed.

This bug appears to be fixed in the CanJS version of route.js where the onready even handler is bound after the setState method is defined:

https://github.com/bitovi/canjs/blob/master/route/route.js#L471

but this defect has not been fixed in Javascript MVC 3.2.4. Are there plans to fix this defect in future releases of JavaScriptMVC?


Viewing all articles
Browse latest Browse all 3491

Trending Articles