Test commit.
[jquery.git] / attr / attr.js
1
2 var pos = [
3   "height", "width", "top", "left", "bottom", "right",
4   "paddingTop", "paddingRight", "paddingBottom", "paddingLeft",
5   "marginTop", "marginRight", "marginBottom", "marginLeft",
6   "lineHeight", "maxWidth", "maxHeight", "minWidth", "minHeight",
7   "textIndent", "fontSize"
8 ];
9
10 for ( var i = 0; i < pos.length; i++ ) {
11         (function(){
12                 var o = pos[i];
13                 $.fn[o] = function(a){
14                         return a ?
15                                 this.css(o,a) :
16                                 parseInt( this.css(o) );
17                 };
18         })();
19 }
20
21 var posArg = [
22         "clientLeft", "clientTop", "clientWidth", "clientHeight",
23         "offsetLeft", "offsetTop", "offsetWidth", "offsetHeight",
24         "scrollLeft", "scrollTop", "scrollWidth", "scrollHeight"
25 ];
26
27 for ( var i = 0; i < posArg.length; i++ ) {
28         (function(){
29                 var o = posArg[i];
30                 $.fn[o] = function(a){
31                         return a ? this.each(function(){
32                                 this[o] = parseInt( a );
33                         }) : this.size() > 0 ?
34                                 this.get(0)[o] :
35                                 null;
36                 };
37         })();
38 }