diff --git a/source/Ox.UI/js/Core/Element.js b/source/Ox.UI/js/Core/Element.js index d3598e1d..f195bf17 100644 --- a/source/Ox.UI/js/Core/Element.js +++ b/source/Ox.UI/js/Core/Element.js @@ -88,16 +88,18 @@ // create private object self = self || {}; - // create defaults and options objects + self.boundTooltipEvents = {}; // FIXME? self.defaults = {}; + self.eventCallbacks = self.eventCallbacks || {}; // allow for Ox.Element('') or Ox.Element('cssSelector') self.options = Ox.isString(options) ? {element: options} : options || {}; - // stack of callbacks bound to option updates - self.updateCallbacks = self.updateCallbacks || []; - - self.boundTooltipEvents = {}; // FIXME? - self.data = {}; - + self.unbindKeyboard = function unbindKeyboard() { + Object.keys(self.eventCallbacks).filter(function(event) { + return /^key([\._][\w\.]+)?$/.test(event); + }).forEach(function(event) { + that.unbindEvent(event); + }); + }; self.update = function update(key, value) { // update is called whenever an option is modified or added Ox.loop(self.updateCallbacks.length - 1, -1, -1, function(index) { @@ -105,6 +107,7 @@ return self.updateCallbacks[index](key, value) !== false; }); }; + self.updateCallbacks = self.updateCallbacks || []; // create public object var that = Object.create(Ox.Element.prototype); @@ -118,16 +121,23 @@ }); that[0] = that.$element[0]; that.length = 1; - that.self = function() { + that.self = function _self() { return arguments[0] === _ ? self : {}; }; Ox.elements[that.oxid] = that; if (self.options.element == '