3 $.fn.get = function(i) {
\r
5 this.$$unclean ? $.sibling(this.$$unclean[0]) : this.cur :
\r
9 $.fn._get = function(i) {
\r
10 return i == null ? this.cur : this.cur[i];
\r
13 $.fn.set = function(a,b) {
\r
14 return this.each(function(){
\r
17 this[$.attr(j)] = a[j];
\r
19 if ( b.constructor != String ) { // TODO: Fix this
\r
20 for ( var i in b ) {
\r
21 var c = $.Select(i,this);
\r
23 c[j][$.attr(a)] = b[i];
\r
26 this[$.attr(a)] = b;
\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
37 var r = $C("div").html(a);
\r
38 r.$$unclean = r.get(0).childNodes;
\r
42 return $(document.createElement(a),document);
\r
46 $.fn.appendTo = function() {
\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
54 $(a[i]).append( this );
\r
59 $.clean = function(a) {
\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
80 // Frequently-used Accessors
\r
81 window.cssQuery = $.Select;
\r
82 document.getElementsByClass = function(a){return $.Select("."+a)};
\r
83 document.getElementsBySelector = $.Select;
\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
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
104 // ancestor-or-self
\r
105 // descendant-or-self
\r
108 //style: function(a,b){ return this.css(a,b); },
\r