@@ -117,41 +117,6 @@ var Position = {
117
117
118
118
/*--------------------------------------------------------------------------*/
119
119
120
- if ( ! document . getElementsByClassName ) document . getElementsByClassName = function ( instanceMethods ) {
121
- function iter ( name ) {
122
- return name . blank ( ) ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]" ;
123
- }
124
-
125
- instanceMethods . getElementsByClassName = Prototype . BrowserFeatures . XPath ?
126
- function ( element , className ) {
127
- className = className . toString ( ) . strip ( ) ;
128
- var cond = / \s / . test ( className ) ? $w ( className ) . map ( iter ) . join ( '' ) : iter ( className ) ;
129
- return cond ? document . _getElementsByXPath ( './/*' + cond , element ) : [ ] ;
130
- } : function ( element , className ) {
131
- className = className . toString ( ) . strip ( ) ;
132
- var elements = [ ] , classNames = ( / \s / . test ( className ) ? $w ( className ) : null ) ;
133
- if ( ! classNames && ! className ) return elements ;
134
-
135
- var nodes = $ ( element ) . getElementsByTagName ( '*' ) ;
136
- className = ' ' + className + ' ' ;
137
-
138
- for ( var i = 0 , child , cn ; child = nodes [ i ] ; i ++ ) {
139
- if ( child . className && ( cn = ' ' + child . className + ' ' ) && ( cn . include ( className ) ||
140
- ( classNames && classNames . all ( function ( name ) {
141
- return ! name . toString ( ) . blank ( ) && cn . include ( ' ' + name + ' ' ) ;
142
- } ) ) ) )
143
- elements . push ( Element . extend ( child ) ) ;
144
- }
145
- return elements ;
146
- } ;
147
-
148
- return function ( className , parentElement ) {
149
- return $ ( parentElement || document . body ) . getElementsByClassName ( className ) ;
150
- } ;
151
- } ( Element . Methods ) ;
152
-
153
- /*--------------------------------------------------------------------------*/
154
-
155
120
Element . ClassNames = Class . create ( ) ;
156
121
Element . ClassNames . prototype = {
157
122
initialize : function ( element ) {
@@ -250,7 +215,7 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
250
215
for ( var i = 0 , length = elements . length ; i < length ; i ++ ) {
251
216
var element = elements [ i ] ;
252
217
if ( match ( element , expression ) ) {
253
- results . push ( Element . extend ( element ) ) ;
218
+ results . push ( element ) ;
254
219
}
255
220
}
256
221
return results ;
@@ -272,7 +237,7 @@ Object.extend(Element.ClassNames.prototype, Enumerable);
272
237
for ( var i = 0 , length = elements . length ; i < length ; i ++ ) {
273
238
element = elements [ i ] ;
274
239
if ( Prototype . Selector . match ( element , expression ) && index === matchIndex ++ ) {
275
- return Element . extend ( element ) ;
240
+ return element ;
276
241
}
277
242
}
278
243
} ,
0 commit comments