diff --git a/source/Ox/js/DOM.js b/source/Ox/js/DOM.js index fbac6b2e..71ef21cc 100644 --- a/source/Ox/js/DOM.js +++ b/source/Ox/js/DOM.js @@ -134,7 +134,7 @@ Ox.$ = Ox.element = function $(value) { value Attribute value @*/ attr: function attr() { - var args = arguments, ret, that = this; + var args = arguments, ret; if (args.length == 1 && Ox.isString(args[0])) { ret = this[0].getAttribute ? this[0].getAttribute(args[0]) @@ -299,7 +299,11 @@ Ox.$ = Ox.element = function $(value) { () -> Height in px @*/ height: function height() { - return elements[0].offsetHeight; + return elements[0][ + elements[0] == document ? 'height' + : elements[0] == window ? 'innerHeight' + : 'offsetHeight' + ]; }, /*@ @@ -384,7 +388,7 @@ Ox.$ = Ox.element = function $(value) { iterator Iterator function @*/ map: function map() { - return Array.prototype.filter.map(elements, arguments); + return Array.prototype.map.apply(elements, arguments); }, /*@ @@ -781,7 +785,11 @@ Ox.$ = Ox.element = function $(value) { () -> Width in px @*/ width: function width() { - return elements[0].offsetWidth; + return elements[0][ + elements[0] == document ? 'width' + : elements[0] == window ? 'innerWidth' + : 'offsetWidth' + ]; } }) : null;