Permalink
Browse files

declare with 'var' for local variables

  • Loading branch information...
dot
dot committed Nov 12, 2008
1 parent 605cd50 commit 3ae87dae14ef7358e0cebf2100f1c71f362f6372
Showing with 4 additions and 4 deletions.
  1. +4 −4 javascripts/sources/jrails.js
@@ -69,14 +69,14 @@
if (typeof window.delayedObserverStack == 'undefined') window.delayedObserverStack = [];
if (typeof window.delayedObserverCallback == 'undefined') {
window.delayedObserverCallback = function(stackPos) {
- observed = window.delayedObserverStack[stackPos];
+ var observed = window.delayedObserverStack[stackPos];
if (observed.timer) clearTimeout(observed.timer);
observed.timer = setTimeout(function(){
observed.timer = null;
observed.callback(observed.obj, observed.obj.formVal());
}, observed.delay * 1000);
observed.oldVal = observed.obj.formVal();
- }
+ };
}
window.delayedObserverStack.push({
obj: el, timer: null, delay: delay,
@@ -87,14 +87,14 @@
$(':input', el).each(function(){
var field = $(this);
field.bind($.fieldEvent(field, delay), function(){
- observed = window.delayedObserverStack[stackPos];
+ var observed = window.delayedObserverStack[stackPos];
if (observed.obj.formVal() == observed.oldVal) return;
else window.delayedObserverCallback(stackPos);
});
});
} else {
el.bind($.fieldEvent(el, delay), function(){
- observed = window.delayedObserverStack[stackPos];
+ var observed = window.delayedObserverStack[stackPos];
if (observed.obj.formVal() == observed.oldVal) return;
else window.delayedObserverCallback(stackPos);
});

0 comments on commit 3ae87da

Please sign in to comment.