[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread kangax
On Aug 19, 2:34 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote: > > > var el = new Prototype.Element(element); > > > el.raw, or el.obj, or el.wrapped, or el.source. > > > I kinda dig el.source > > > `source` sounds good. > > It's not very important, but I can't say "source" appeals.  I think it > wi

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread T.J. Crowder
> On the other hand, if we have a common property for accessing "origin" > of both `Node` and `NodeList` wrappers, shouldn't it be of the same > type? I don't see any reason it does, no. My reason for suggesting a unified term was mostly for the convenience of users of the API, not primarily so

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread John-David Dalton
@kangax Whatever the name is I think it should be used in all wrappers. This makes it consistent. If you want to check if a wrapper is of a certain instance. if( wrapper instanceof Prototype.Node ) { //wrapper.raw } else if (wrapper instanceof Prototype.NodeList) { //wrapper.raw } ... I li

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread John-David Dalton
More on the get/set Maybe get/set are more generalized Get: would first check the property and then the attribute; Set: would use the element['somePropOrAttrib'] = value; instead of setAttribute and let the browser figure it out. If you want finer grain then you can use getProperty() and getAttr

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread Johan McCain
Wrapping elements with divs seems like overkill to me. It will break layouts and give unexpected results when you have some css like: .myclass div { margin-left: 10px; padding: 5px;} People will be left wondering why all of a sudden their layouts are screwed because everything doubles. I'm not s

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread kangax
On Aug 19, 12:03 pm, John-David Dalton <[EMAIL PROTECTED]> wrote: > @kangax > > Whatever the name is I think it should be used in all wrappers. > This makes it consistent. > > If you want to check if a wrapper is of a certain instance. > if( wrapper instanceof Prototype.Node ) { >//wrapper.raw

[Prototype-core] Re: Prototype's use of global variables

2008-08-19 Thread kangax
On Aug 19, 12:35 pm, John-David Dalton <[EMAIL PROTECTED]> wrote: > More on the get/set > > Maybe get/set are more generalized > Get: would first check the property and then the attribute; > Set: would use the element['somePropOrAttrib'] = value; > instead of setAttribute and let the browser figur

[Prototype-core] "Element wrapper" draft notes

2008-08-19 Thread kangax
As per a recent discussion http://groups.google.com/group/prototype-core/browse_thread/thread/16d0517ecc605a00 I have made a few notes regarding a potential semantics of an "element wrapper" implementation : ) == Notes: - The notion of `NodeWrapper` is used to refer to such "element wrapper". -

[Prototype-core] Re: "Element wrapper" draft notes

2008-08-19 Thread Walter Lee Davis
On Aug 19, 2008, at 11:46 PM, kangax wrote: > $W('foo').wrap('div', { className: 'bar' }); // NodeWrapper around a > newly created `div` element with class="bar" Sorry to barge in the middle here, but could you clarify what 'foo' means here? Is 'foo' the ID of the newly-created div.bar? Or

[Prototype-core] Re: "Element wrapper" draft notes

2008-08-19 Thread kangax
On Aug 20, 12:02 am, Walter Lee Davis <[EMAIL PROTECTED]> wrote: > On Aug 19, 2008, at 11:46 PM, kangax wrote: > > >   $W('foo').wrap('div', { className: 'bar' }); // NodeWrapper around a > > newly created `div` element with class="bar" > > Sorry to barge in the middle here, but could you clarify