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

2008-08-20 Thread John-David Dalton
Johan, when we say wrapper we don't mean a div in HTML. We mean instead of extending the native DOM elements $(element) - returns an extended dom element $(element) - returns an instance of a ElementWrapper class the class interacts with the element but does not extend it directly. see kangax's

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

2008-08-19 Thread T.J. Crowder
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 will be confusing in discussion. The underlying element is as much a target as a

[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

[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} else

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

2008-08-18 Thread John-David Dalton
If a cache is to be used it can be uniquely marked via the same approach as elements in the event system element._prototypeWrapperId = [arguments.callee.id++]; the id is unique and doesn't transfer if you clone the node. var instance = Prototype.Element.cache[ element._prototypeWrapperId ]; if

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

2008-08-18 Thread T.J. Crowder
I like the imports idea. I think adding custom prefixes is a bit much though. (or maybe its just the method name that bothers me) If we're going to continue enhancing some host objects (String, Functino) and not others (Element, Array), I'd suggest we drop the idea of custom prefixes anyway

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

2008-08-18 Thread kangax
On Aug 18, 11:27 am, John-David Dalton [EMAIL PROTECTED] wrote: If a cache is to be used it can be uniquely marked via the same approach as elements in the event system element._prototypeWrapperId = [arguments.callee.id++]; the id is unique and doesn't transfer if you clone the node. var