IE flicker has been killed and setAuto now works in Firefox and IE.
[jquery.git] / tmpl / tmpl.js
1 // test commit\r
2 \r
3 $.fn.get = function(i) {\r
4         return i == null ?\r
5                 this.$$unclean ? $.sibling(this.$$unclean[0]) : this.cur :\r
6                         (this.get())[i];\r
7 };\r
8 \r
9 $.fn._get = function(i) {\r
10         return i == null ? this.cur : this.cur[i];\r
11 };\r
12 \r
13 $.fn.set = function(a,b) {\r
14         return this.each(function(){\r
15                 if ( b == null )\r
16                         for ( var j in a )\r
17                                 this[$.attr(j)] = a[j];\r
18                 else {\r
19                         if ( b.constructor != String ) { // TODO: Fix this\r
20                                 for ( var i in b ) {    \r
21                                         var c = $.Select(i,this);\r
22                                         for ( var j in c )\r
23                                                 c[j][$.attr(a)] = b[i];\r
24                                 }\r
25                         } else\r
26                                 this[$.attr(a)] = b;\r
27                 }\r
28         });\r
29 };\r
30 \r
31 function $C(a) {\r
32   if ( a.indexOf('<') >= 0 ) {\r
33     if ( a.indexOf('<tr') >= 0 ) {\r
34       var r = $C("table").html("<tbody>"+a+"</tbody>");\r
35       r.$$unclean = r.get(0).childNodes[0].childNodes;\r
36     } else {\r
37       var r = $C("div").html(a);\r
38       r.$$unclean = r.get(0).childNodes;\r
39     }\r
40     return r;\r
41   } else {\r
42     return $(document.createElement(a),document);\r
43   }\r
44 };\r
45 \r
46 $.fn.appendTo = function() {\r
47         var self = this;\r
48         var a = arguments;\r
49         return this.each(function(){\r
50                 for ( var i = 0; i < a.length; i++ ) {\r
51                         if ( self.$$unclean )\r
52                                 $(a[i]).append( self.get() );\r
53                         else\r
54                                 $(a[i]).append( this );\r
55                 }\r
56         });\r
57 };\r
58 \r
59 $.clean = function(a) {\r
60         var r = [];\r
61         for ( var i = 0; i < a.length; i++ ) {\r
62                 if ( a[i].constructor == String ) {\r
63                         // Cool, but has scary side-effects\r
64                         //a[i] = a[i].replace( /#([a-zA-Z0-9_-]+)/g, " id='$1' " );\r
65                         //a[i] = a[i].replace( /\.([a-zA-Z0-9_-]+)/g, " class='$1' " );\r
66                         var div = document.createElement("div");\r
67                         div.innerHTML = a[i];\r
68                         for ( var j = 0; j < div.childNodes.length; j++ )\r
69                                 r[r.length] = div.childNodes[j];\r
70                 } else if ( a[i].length ) {\r
71                         for ( var j = 0; j < a[i].length; j++ )\r
72                                 r[r.length] = a[i][j];\r
73                 } else {\r
74                         r[r.length] = a[i];\r
75                 }\r
76         }\r
77         return r;\r
78 };\r
79 \r
80 // Frequently-used Accessors\r
81 window.cssQuery = $.Select;\r
82 document.getElementsByClass = function(a){return $.Select("."+a)};\r
83 document.getElementsBySelector = $.Select;\r
84 \r
85         \r
86         // Make Xpath Axes Sane\r
87         //var re = new RegExp( "/?descendant::", "i" );\r
88         //t = t.replace( re, " " );\r
89         //var re = new RegExp( "/?child::", "i" );\r
90         //t = t.replace( re, "/" );\r
91         // If only...\r
92         //var re = new RegExp( "/?following-sibling::", "i" );\r
93         //t = t.replace( re, " + " );\r
94         //var re = new RegExp( "/?preceding-sibling::", "i" );\r
95         //t = t.replace( re, " ~ " );\r
96         //var re = new RegExp( "/?self::", "i" );\r
97         //t = t.replace( re, "" );\r
98         //var re = new RegExp( "/?parent::", "i" );\r
99         //t = t.replace( re, " .. " );\r
100         \r
101         // following\r
102         // preceding\r
103         // ancestor\r
104         // ancestor-or-self\r
105         // descendant-or-self\r
106 \r
107 // Deprecated\r
108 //style: function(a,b){ return this.css(a,b); },\r