diff --git a/controller.boolean.js b/controller.boolean.js index dceaebe..eb2c0f8 100644 --- a/controller.boolean.js +++ b/controller.boolean.js @@ -13,7 +13,7 @@ var BooleanController = function() { }, false); input.addEventListener('mouseup', function(e) { - input.checked = !input.checked; + input.checked = !input.checked; // counteracts default. }, false); this.domElement.style.cursor = 'pointer'; diff --git a/controller.function.js b/controller.function.js index 5e5a58c..5b5e765 100644 --- a/controller.function.js +++ b/controller.function.js @@ -1,8 +1,13 @@ var FunctionController = function() { this.type = "function"; + var _this = this; Controller.apply(this, arguments); var input = document.createElement('input'); input.setAttribute('type', 'submit'); + this.domElement.addEventListener('click', function() { + _this.object[_this.propertyName].call(_this.object); + }, false); + this.domElement.style.cursor = "pointer"; this.domElement.appendChild(input); }; FunctionController.prototype = new Controller(); diff --git a/controller.js b/controller.js index 01bf8b8..e6f6551 100644 --- a/controller.js +++ b/controller.js @@ -19,5 +19,12 @@ var Controller = function() { this.setName(this.propertyName); this.domElement.appendChild(this.propertyNameElement); + makeUnselectable(this.domElement); + function makeUnselectable(elem) { + elem.onselectstart = function() { return false; }; + elem.style.MozUserSelect = "none"; + elem.style.KhtmlUserSelect = "none"; + elem.unselectable = "on"; + } }; \ No newline at end of file diff --git a/controller.string.js b/controller.string.js index 8261ded..6d66891 100644 --- a/controller.string.js +++ b/controller.string.js @@ -9,8 +9,9 @@ var StringController = function() { var input = document.createElement('input'); input.setAttribute('value', this.object[this.propertyName]); - this.domElement.addEventListener('mouseover', function() { + this.domElement.addEventListener('mouseup', function() { input.focus(); + input.select(); }, false); input.addEventListener('keyup', function() {