From 76278bf1a04a18c67d9713c5c4930a1ba92b46f0 Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Mon, 24 Jan 2011 13:27:45 -0800 Subject: [PATCH] addEventListener-fied NavigationController --- controller.number.js | 16 ++++++++-------- controller.string.js | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/controller.number.js b/controller.number.js index cfbb1b4..ba2c23d 100644 --- a/controller.number.js +++ b/controller.number.js @@ -24,10 +24,10 @@ var NumberController = function() { button.setAttribute('value', inc) this.domElement.appendChild(button); - button.onmousedown = function(e) { + button.addEventListener('mousedown', function(e) { isClicked = true; - }; - button.onkeyup = function(e) { + }, false); + button.addEventListener('keyup', function(e) { var val = parseFloat(this.value); if(isNaN(val)) { inc = initialValue; @@ -36,11 +36,11 @@ var NumberController = function() { } this.value = inc; _this.setValue(inc); - } - document.onmouseup = function(e) { + }, false); + document.addEventListener('mouseup', function(e) { isClicked = false; - }; - document.onmousemove = function(e) { + }, false); + document.addEventListener('mousemove', function(e) { if(isClicked) { e.preventDefault(); py = y; @@ -61,7 +61,7 @@ var NumberController = function() { button.value = inc; _this.setValue(inc); } - }; + }, false); this.__defineSetter__("position", function(val) { inc = val; diff --git a/controller.string.js b/controller.string.js index 07b6b86..679e59c 100644 --- a/controller.string.js +++ b/controller.string.js @@ -20,12 +20,12 @@ var StringController = function() { _this.setValue(input.value); }, false); - input.onblur = function(e) { + input.addEventListener('blur', function(e) { if(_this.getValue() == '') { _this.setValue(initialValue); this.value = initialValue; } - }; + }, false); this.domElement.appendChild(input); };