Moved plugins to the new plugin directory.
[jquery.git] / plugins / compat / compat.js
1         // Since we're using Prototype's $ function,
2         // be nice and have backwards compatability
3         if ( typeof Prototype != "undefined" ) {
4                 if ( $a.constructor == String ) {
5                         var re = new RegExp( "[^a-zA-Z0-9_-]" );
6                         if ( !re.test($a) ) {
7                                 $c = $c && $c.documentElement || document;
8                                 if ( $c.getElementsByTagName($a).length === 0 ) {
9                                         var obj = $c.getElementById($a);
10                                         if ( obj ) { return obj; }
11                                 }
12                         }
13                 } else if ( $a.constructor == Array ) {
14                         return $.map( $a, function(b){
15                                 if ( b.constructor == String ) {
16                                         return document.getElementById(b);
17                                 }
18                                 return b;
19                         });
20                 }
21         }
22
23 // TODO: Remove need to return this
24         for ( var i in $.fn ) {
25                 if ( self[i] !== null )
26                         self["_"+i] = self[i];
27                 self[i] = $.fn[i];
28         }
29
30         if ( typeof Prototype != "undefined" && $a.constructor != String ) {
31                 if ( $c ) $a = self.get();
32                 for ( var k in self ) {(function(j){
33                         try {
34                                 if ( !$a[j] )
35                                         $a[j] = function() {
36                                                 return $.apply(self,self[j],arguments);
37                                         };
38                         } catch(e) {}
39                 })(k);}
40                 return $a;
41         }