Added a possible fix for document.ready on https: sites, in IE.
[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 }
39
40 $.fn.text = function(e) {
41         e = e || this.cur;
42         var t = "";
43         for ( var j = 0; j < e.length; j++ ) {
44                 for ( var i = 0; i < e[j].childNodes.length; i++ ) {
45                         t += e[j].childNodes[i].nodeType != 1 ?
46                                 e[j].childNodes[i].nodeValue :
47                                 $.fn.text(e[j].childNodes[i].childNodes);
48                 }
49         }
50         return t;
51 };