@@ -17,24 +17,33 @@ define([ "jquery",
1717 // TODO use the originalEvent property on the event object
1818 // instead of from
1919 popstate : function ( event ) {
20- var state = event . originalEvent . state ;
20+ var newEvent = new $ . Event ( "navigate" ) ,
21+ state = event . originalEvent . state ;
22+
23+ // Make sure the original event is tracked for the end
24+ // user to inspect incase they want to do something special
25+ newEvent . originalEvent = event ;
2126
2227 // NOTE the `|| {}` is there to ensure consistency between
2328 // the popstate navigate event and the hashchange navigate
2429 // event data
25- $win . trigger ( new $ . Event ( "navigate" ) , {
26- from : "popstate" ,
30+ $win . trigger ( newEvent , {
2731 state : state || { }
2832 } ) ;
2933 } ,
3034
3135 // TODO use the originalEvent property on the event object
3236 // instead of from
3337 hashchange : function ( event , data ) {
38+ var newEvent = new $ . Event ( "navigate" ) ;
39+
40+ // Make sure the original event is tracked for the end
41+ // user to inspect incase they want to do something special
42+ newEvent . originalEvent = event ;
43+
3444 // Trigger the hashchange with state provided by the user
3545 // that altered the hash
36- $win . trigger ( new $ . Event ( "navigate" ) , {
37- from : "hashchange" ,
46+ $win . trigger ( newEvent , {
3847 // Users that want to fully normalize the two events
3948 // will need to do history management down the stack and
4049 // add the state to the event before this binding is fired
0 commit comments