@@ -118,25 +118,27 @@ steal('can/observe', 'can/util/string/deparam', function() {
118
118
propCount = 0 ;
119
119
120
120
delete data . route ;
121
- // If we have a route name in our `can.route` data, use it.
122
- if ( ! ( routeName && ( route = can . route . routes [ routeName ] ) ) ) {
123
- each ( data , function ( ) { propCount ++ } ) ;
124
- // Otherwise find route.
125
- each ( can . route . routes , function ( temp , name ) {
126
- // best route is the first with all defaults matching
127
-
128
-
129
- matchCount = matchesData ( temp , data ) ;
130
- if ( matchCount > matches ) {
131
- route = temp ;
132
- matches = matchCount
133
- }
134
- if ( matchCount >= propCount ) {
135
- return false ;
136
- }
137
- } ) ;
121
+
122
+ each ( data , function ( ) { propCount ++ } ) ;
123
+ // Otherwise find route.
124
+ each ( can . route . routes , function ( temp , name ) {
125
+ // best route is the first with all defaults matching
126
+
127
+
128
+ matchCount = matchesData ( temp , data ) ;
129
+ if ( matchCount > matches ) {
130
+ route = temp ;
131
+ matches = matchCount
132
+ }
133
+ if ( matchCount >= propCount ) {
134
+ return false ;
135
+ }
136
+ } ) ;
137
+ // If we have a route name in our `can.route` data, and it's
138
+ // just as good as what currently matches, use that
139
+ if ( can . route . routes [ routeName ] && matchesData ( can . route . routes [ routeName ] , data ) === matches ) {
140
+ route = can . route . routes [ routeName ] ;
138
141
}
139
-
140
142
// If this is match...
141
143
if ( route ) {
142
144
var cpy = extend ( { } , data ) ,
@@ -416,7 +418,6 @@ steal('can/observe', 'can/util/string/deparam', function() {
416
418
clearTimeout ( timer ) ;
417
419
timer = setTimeout ( function ( ) {
418
420
var serialized = can . route . data . serialize ( ) ;
419
- delete serialized . route ;
420
421
location . hash = "#!" + can . route . param ( serialized )
421
422
} , 1 ) ;
422
423
} ) ;
0 commit comments