Yeap, something like that. -- Ariel Flesler http://flesler.blogspot.com
On 25 mayo, 13:10, Kai Bansner <[EMAIL PROTECTED]> wrote: > > Rewriting jQuery.each could fix most problems, still I'm not aware of > > ALL the spots. > > Modifying all the for..in SHOULD be enough. > > > -- > > Ariel Fleslerhttp://flesler.blogspot.com > > I like that ... any tips on how to detect which properties were added > to the object via a Object.prototype? These are the value jQuery.each > will need to skip. > > I gleaned this little snippet of code from another discussion on the > internet which took place back in 2006, but it only helps when it's > run before Prototype. It keeps all of the Prototype extended methods > from showing up on new objects. I'm assuming my answer has something > to do with .hasOwnProperty. > > if( !Object.prototype.hasOwnProperty ) { > Object.prototype.hasOwnProperty = function( property ) { > try { > var prototype = this.constructor.prototype; > while( prototype ) { > if( prototype[ property ] == > this[ property ] ) { > return false; > } > prototype = prototype.prototype; > } > } catch( e ) {} > return true; > } > } > Object.prototype.extend = function( object ) { > for( var property in object ) { > try { > if( !this.prototype[ property ] && > object.hasOwnProperty( property ) ) > this.prototype[ property ] = > object[ property ]; > } catch( e ) {} > } > }