diff --git a/source/Ox/js/DOM.js b/source/Ox/js/DOM.js index f60befa5..ad8e8b35 100644 --- a/source/Ox/js/DOM.js +++ b/source/Ox/js/DOM.js @@ -75,7 +75,7 @@ Ox.$ = Ox.element = function(val) { // fixme: remove click and mousedown, // add native css selector // take all matches of getElementsBy... - var element = Ox.isObject(val) ? val // window + var element = Ox.isObject(val) ? val // window or document : val[0] == '<' ? document.createElement(Ox.sub(val, 1, -1)) : val[0] == '#' ? document.getElementById(Ox.sub(val, 1)) : val[0] == '.' ? document.getElementsByClassName(Ox.sub(val, 1))[0] @@ -187,8 +187,7 @@ Ox.$ = Ox.element = function(val) { return ret; }, empty: function() { - this.html(''); - return this; + return this.html(''); }, /*@ hasClass Returns true if the element has a given class @@ -198,6 +197,12 @@ Ox.$ = Ox.element = function(val) { hasClass: function(str) { return this[0].className.split(' ').indexOf(str) > -1; }, + height: function() { + return this[0].offsetHeight; + }, + hide: function() { + return this.css({display: 'none'}); + }, /*@ html Gets or sets the inner HTML () -> The inner HTML @@ -250,9 +255,15 @@ Ox.$ = Ox.element = function(val) { ).join(' '); return this; }, + show: function() { + return this.css({display: 'block'}); + }, unbind: function(event) { this[0]['on' + event] = null; return this; + }, + width: function() { + return this[0].offsetWidth; } } : null; }; \ No newline at end of file