[Prototype-core] Event.stopObserving, does it do proper cleanup?

2007-01-26 Thread Colin Mollenhour
I noticed that Event.stopObserving does not actually remove the array of [element,name,observer] from the observers cache that it adds when you call Event.observe. Could this be preventing proper garbage collection? Say you create a div and observe it with Event.observe and a function that

[Prototype-core] Improved mass-observer handling

2007-01-26 Thread Colin Mollenhour
I have found that when creating an advanced prototype based class/widget, that all of the Event.observe and Event.stopObserving handling gets to be a pain in the ass.. I think it would be great to extend the current Event methods in Prototype to support some sort of grouping of events. Depending

[Prototype-core] Re: Improved mass-observer handling

2007-01-26 Thread Colin Mollenhour
Ok, I've written the code to make this happen, it works great, is a pleasure to code, and has been submitted for your own viewing pleasure! I could use some help on test cases. I ran the unit tests but none of them are specific to Event.observe/Event.stopObserving and I need to write new ones for

[Prototype-core] Re: Event.stopObserving, does it do proper cleanup?

2007-01-26 Thread Colin Mollenhour
Regardless of whether or not it causes a circular reference in IE, it does still keep some data in the cache which is a waste (considering things like tooltips are creating and destroying possibly many events in one second). So, I included this fix in my patch

[Prototype-core] Re: Event.stopObserving, does it do proper cleanup?

2007-01-28 Thread Colin Mollenhour
I don't know if it is javascript, firebug, firefox or what, but after running firefox for a while it's memory usage will creep up to over 250mb (Mem Usage and VM Size in the task manager). I have to wonder if my Ajax heavy pages contribute to this so I'm not so convinced that garbage

[Prototype-core] Re: Improved mass-observer handling

2007-01-28 Thread Colin Mollenhour
First of all, I disapprove of marking #6509 as fixed because it isn't, the patch is just superseded by another. You should have marked it as duplicate. Roget that. My bad, I'm still new to the Trac system.. Second, I don't like breaking backwards compatibility with this additional first

[Prototype-core] Re: More Event Handling Propositions

2007-02-08 Thread Colin Mollenhour
I've been doing a lot of research on the subject of Event registration. It made me question: do we really need to detach listeners in IE on unload? Unless anyone knows for sure, I plan to test. According to what I've read primarily here: http://javascript.crockford.com/memory/leak.html it is

[Prototype-core] Re: What is the reason for this?

2007-02-14 Thread Colin Mollenhour
Lol, nice.. I agree though, if someone doesn't care about Prototype enough to read the changelogs and blog, then why is he updating anyway? So does RoR use the Toggle.display method? Cuz I had never even seen it mentioned or used anywhere before. Colin On Feb 14, 6:51 am, Mislav Marohnić

[Prototype-core] Re: Ajax.Request Breaks on Firefox 2.0.0.1

2007-02-23 Thread Colin Mollenhour
Man this is getting annoying.. I wish json.org would change their code or Prototype would use $H().each in setRequestHeaders or both (preferable) would happen soon. This is popping up on Rails Spinoffs at least twice a day it seems. You included the new JSON library from json.org? That is what

[Prototype-core] Re: new Event functionality

2007-02-23 Thread Colin Mollenhour
I'm working on extending your patch with my EventCache feature. Your Observer class has grown on me so I'd prefer to just extend your code. :) I've been doing a lot of testing and one thing I've noticed is in IE, if you call Event.stopObserving with a function that isn't currently being observed

[Prototype-core] Re: new Event functionality

2007-02-23 Thread Colin Mollenhour
But it doesn't stop there. Ken Snyder and Colin Mollenhour have been collaborating on #7435 that enhances the Event module with a new cache system and some API extensions for bulk observer removing. Maybe some of those ideas are worthy, so I'd like to have other's opinions. Ok, like I said

[Prototype-core] Re: new Event functionality

2007-02-23 Thread Colin Mollenhour
Oops, my links are localhost! lol... Here is the test page: http://colin.mollenhour.com/events/test.html And the new hybrid code: http://colin.mollenhour.com/events/event-hybrid.js Just in case it wasn't clear before, hybrid is Mislav's and Andrew's 6194 patch that has been slightly reconfigured

[Prototype-core] Re: new Event functionality

2007-02-25 Thread Colin Mollenhour
That's just it, I don't fully understand how your GC class is supposed to work so I was hoping to see a real-world usage example, but if you are too busy I can understand that completely (maybe you have a page up already that you could provide a link to?). I think your focus is on scalability

[Prototype-core] Re: new Event functionality

2007-02-26 Thread Colin Mollenhour
Thanks for taking the time to write that up. I think you and I are more on the same page than we thought, your example looks very similar in structure to my example. I would be completely happy with what you proposed except for the redundancy. Since Prototype already does global caching (only

[Prototype-core] Re: new Event functionality

2007-02-28 Thread Colin Mollenhour
Maybe we can expose the (currently hidden) Observer class, allowing for a plugin? I couldn't complain about that now, could I? :) I still think it would be great to add to core, because then SAU and other widgets could be patched to take advantage of the separate caching benefits, but I can't

[Prototype-core] Re: new Event functionality

2007-02-28 Thread Colin Mollenhour
It's good to know I'm not *totally* out of my mind... :) Thanks, Colin I'm not a core developer, so my opinion has no weight ... but I like the concept. Really. =) I think it would cleanup the widget destroy functions. For example, complex Sortables. TAG

[Prototype-core] Re: Hash.toQueryString changes

2007-03-05 Thread Colin Mollenhour
Is 2 not incorrect? That should be foo[]=afoo[]=b if I'm not mistaken... On the server side you will get foo=b. Similarly for 3 you will get foo=c. I haven't looked at the code or thought about it much, but I would like to see recursion of hashes and arrays. If you do 4, I would guess that

[Prototype-core] Re: Hash.toQueryString changes

2007-03-14 Thread Colin Mollenhour
Yes, as I stated in my previous post as well, this *definitely* need to be changed to follow the array name with brackets, otherwise you are simply redefining that variable over and over again and it will simply equal the last value. Maybe rails handles this correctly but probably nothing else

[Prototype-core] Re: Hash.toQueryString changes

2007-03-14 Thread Colin Mollenhour
Trac isn't responding at the moment so I can't explore and see what other problems Hash.toQueryString is having, but I completely rewrote it myself to support nested structures and the rewrite handles all of the cases mentioned in this thread correctly (including for servers out there that aren't

[Prototype-core] Re: Hash.toQueryString changes

2007-03-15 Thread Colin Mollenhour
WTF!?!?!? This is the fifth time I have posted a reply to a thread via google groups and it says the post was successful and then it never shows up!! Ok, I honestly don't care anymore as this is way more trouble than it is worth. It is much easier to maintain a file of all of my personal patches

[Prototype-core] Re: Hash.toQueryString changes

2007-03-15 Thread Colin Mollenhour
Try this echo service: request:http://www.neohub.com/ws/echo?foo=1;foo=2;foo=3;bar=4 answer: {'bar':4,'foo':[1,2,3]} Would you care to mention what platform and what method of parsing into variables is being used in that test? The results are different than my Rails test. Hehe, now you

[Prototype-core] Re: Hash.toQueryString changes

2007-03-15 Thread Colin Mollenhour
Here's mine. First, it uses $H(value).findAll, so it isn't safe (try feeding it each, for instance). The new function in 1.5.1_rc1 has the same problem so I figured you were comfortable with that fact already.. I don't see a good solution to this as long as hash prototypes are extended.

[Prototype-core] Re: Hash.toQueryString changes

2007-03-16 Thread Colin Mollenhour
After seeing all of the server-side inconsistencies with url decoding, I too agree that Hash.toQueryString is getting too complicated. In fact, what was wrong with the old one? The one currently in 1.5.1_rc2 needs to go as it has several problems that the old one didn't have and it is pretty

[Prototype-core] CSS syntax for node creation?

2007-03-20 Thread Colin Mollenhour
Just a thought, if a future version of prototype were to include a simple element creation method, what about using CSS syntax for specification of id and class? i.e.: var node = new Element('div#mynode.someClass'); Could the new CSS3 parser be easily reused to implement this? I looked at it

[Prototype-core] Re: Hash.toQueryString changes

2007-03-20 Thread Colin Mollenhour
If we are talking about form serialization, then when is it even possible to have null or undefined values? Form.serialize grabs all form elements, so if it does it's job correctly then undefined is out of the picture. On FF (haven't tested else where or looked up specs) the .value property

[Prototype-core] Re: Hash.toQueryString changes

2007-03-21 Thread Colin Mollenhour
I've written new code that I think will offer the most functionality to the most people. The only functions modified are Form.serializeElements, Form.Methods.serialize, Hash.toQueryString and String.prototype.toQueryParams. - Forms are serialized directly to strings so that there is no hash

[Prototype-core] Form.serialize, Ajax.Request, Hash.toQueryString, .toQueryParams

2007-03-22 Thread Colin Mollenhour
I started a new thread on this since it was getting quite long and I now have a new take on the subject. The changes to these functions introduced in 1.5.1 have broken a few things, no doubt about that. The problem is Ajax.Request always converts parameters into a Hash, making *assumptions*

[Prototype-core] Re: Form.serialize, Ajax.Request, Hash.toQueryString, .toQueryParams

2007-03-26 Thread Colin Mollenhour
Sweet, no replies.. I guess I've worn out my welcome with the Prototype Core team. No problem, I'll just go back to waiting for final versions and keep my opinions and code to myself. Oh I've always wanted to say this, but Christophe your contributions to the Spinoffs list are amazing, I don't

[Prototype-core] Re: Form.serialize, Ajax.Request, Hash.toQueryString, .toQueryParams

2007-03-27 Thread Colin Mollenhour
Re using JSON: if you're going to do this you might as well encode it all as JSON in the first place don't you think since that would require extra attention on the server-side anyway? Mixing encoding schemes, really? I was hoping a solution that was compatible with nearly all servers and was

[Prototype-core] Re: Form.serialize, Ajax.Request, Hash.toQueryString, .toQueryParams

2007-03-29 Thread Colin Mollenhour
Awesome, I'll check it out (literally). Thanks, Colin On Mar 28, 6:36 am, Mislav Marohnić [EMAIL PROTECTED] wrote: Collin (and others) - Please check out the latest trunk. Yesterday's update fixes the final minor issues:http://dev.rubyonrails.org/changeset/6481 See the unit tests for

[Prototype-core] Re: Image File Serialize

2007-03-29 Thread Colin Mollenhour
See this for a start. It is nowhere near Prototype Core quality but it works. http://pastie.caboo.se/50410 Colin On Mar 28, 9:02 am, Stefan Liebenberg [EMAIL PROTECTED] wrote: Hey Does anybody know how to send a serialized upload file value thing to your server I tried and i suck.