Ox.$: remove unused var, better height/width, fix typo in .map
This commit is contained in:
parent
869a5ef5ee
commit
7f8403d89f
1 changed files with 12 additions and 4 deletions
|
@ -134,7 +134,7 @@ Ox.$ = Ox.element = function $(value) {
|
|||
value <s> 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) {
|
|||
() -> <n> 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 <f> 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) {
|
|||
() -> <n> Width in px
|
||||
@*/
|
||||
width: function width() {
|
||||
return elements[0].offsetWidth;
|
||||
return elements[0][
|
||||
elements[0] == document ? 'width'
|
||||
: elements[0] == window ? 'innerWidth'
|
||||
: 'offsetWidth'
|
||||
];
|
||||
}
|
||||
|
||||
}) : null;
|
||||
|
|
Loading…
Reference in a new issue