Permalink
Browse files

Fixed incompatibility with Prototype 1.6, URLs were being incorrectly…

… generated.
  • Loading branch information...
1 parent 58b6e07 commit 7c67dbd2a0862cabf3022e2cbd7e263563d2907b Eric Mill committed Apr 25, 2008
Showing with 8 additions and 7 deletions.
  1. +8 −7 jester.js
View
@@ -256,15 +256,16 @@ Object.extend(Jester.Resource, {
},
_interpolate: function(string, params) {
+ if (!params) return string;
+
var result = string;
- for(var val in params) {
- var re = new RegExp(":" + val, "g");
- if(result.match(re))
- {
- result = result.replace(re, params[val]);
- delete params[val];
+ params.each(function(pair) {
+ var re = new RegExp(":" + pair.key, "g");
+ if (result.match(re)) {
+ result = result.replace(re, pair.value);
+ params.unset(pair.key);
}
- }
+ });
return result;
},

0 comments on commit 7c67dbd

Please sign in to comment.