[JSMentors] DOM Unit Alpha 0.3

2010-12-21 Thread Garrett Smith
Hey all, I'm working on a unit testing framework for unit testing javascript abstractions that run in browsers: domunit. https://github.com/GarrettS/ape-javascript-library/downloads The framework uses declarative style object literals for testing; each test is property name that starts with

Re: [JSMentors] Performance of apply vs call

2010-12-21 Thread Balázs Galambosi
Shane Tomlinson wrote: I realize it is probably a micro-optimization and I don't need to change my code in most places, but I was thinking if I ever came into a performance critical loop where a superclass' function was called, this could start to become an issue. I tend to dislike when

Re: [JSMentors] Performance of apply vs call

2010-12-21 Thread Balázs Galambosi
So thanks for the answer, and before flaming the next person, consider that there are legitimate uses that you haven't thought of. I don't know where you got the feeling that I'm flaming you. :) I was basically stating facts. If you need to create that many object in a loop, you're doing it

[JSMentors] Re: Tail-call optimization for mutual recursion

2010-12-21 Thread glathoud
I have measured the speed of two sorts of Javascript trampolines, which in both cases turned out to be about two orders of magnitude slower than iterative code: http://glat.info/pub/tailopt-js/tailopt-js-appendices.xhtml (mutual recursion supported) As for the setTimeout solution, yes it

Re: [JSMentors] Legacy Javascript Code Strategies

2010-12-21 Thread Garrett Smith
On 12/21/10, Scott Koon sc...@lazycoder.com wrote: I've done this as well. Basically the legacy global functions turn into functions that just forward on a call to my refactored code. I pull everything out of the global function and put it into a namespaced object, then call the namespaced

Re: [JSMentors] JavaScript MVC is a good idea?

2010-12-21 Thread Acaz Souza Pereira
Someone else have another opinions? I'm need to choose a framework to use in a small/medium project. 2010/12/20 Shane Tomlinson set...@gmail.com Hey Acaz, I was just checking over your link there and it seems pretty full featured - there are actually quite a few MVC libraries out there

Re: [JSMentors] DOM Unit Alpha 0.3

2010-12-21 Thread Balázs Galambosi
2010/12/21 Garrett Smith dhtmlkitc...@gmail.com: There is also the sore spot of not being able to set the `toElement` or `fromElement in MSIE. I already posted about that on the jsmentors mailing list, when it was a good mailing list, and before the whole thing moved to GG. Until you post

[JSMentors] Performance comparison: dom tree clone vs. creating each element

2010-12-21 Thread Andraž Kos
Is in your opinion better to create a DOM tree only once, clone it and then traverse the clone only to update data, or to create everything by hand over and over again? Example jsFiddle: http://jsfiddle.net/77Zxy/ -- To view archived discussions from the original JSMentors Mailman list:

Re: [JSMentors] Performance comparison: dom tree clone vs. creating each element

2010-12-21 Thread Acaz Souza Pereira
I do a test for you about that in JS PERF: http://jsperf.com/dom-tree-clone-vs-creating-each-element 2010/12/21 Acaz Souza Pereira acazso...@gmail.com Try using http://jsperf.com/ to do some tests 2010/12/21 Andraž Kos andraz@gmail.com Is in your opinion better to create a DOM tree only

Re: [JSMentors] Performance comparison: dom tree clone vs. creating each element

2010-12-21 Thread Poetro
2010/12/22 Andraž Kos andraz@gmail.com Thank you for your help. http://jsperf.com/dom-tree-clone-vs-creating-each-element/2 Tests show that cloning is 38% better performer. What part of the code would be the most likely culprit, the repeated calls to new Element or something else? On

Re: [JSMentors] JavaScript MVC is a good idea?

2010-12-21 Thread Acaz Souza Pereira
The store will then send a notification event to the grid, which will update the view to eliminate the row corresponding to the deleted item. This follows proper MVC flow, with the controller affecting the model, which then affects the view. In MVC pattern, MODEL don't communicate with VIEW,

Re: [JSMentors] Performance comparison: dom tree clone vs. creating each element

2010-12-21 Thread Balázs Galambosi
2010/12/22 Poetro poe...@gmail.com: There is some problem with these tests, as it throws some error in Opera 11. And the error is somewhat strange, at least i haven't seen such (although i've never used MooTools either). Error: java.lang.NoSuchFieldException: getAttribute in class: nano.

Re: [JSMentors] JavaScript MVC is a good idea?

2010-12-21 Thread Bryan Forbes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/21/10 5:21 PM, Acaz Souza Pereira wrote: The store will then send a notification event to the grid, which will update the view to eliminate the row corresponding to the deleted item. This follows proper MVC flow, with the controller affecting

Re: [JSMentors] Legacy Javascript Code Strategies

2010-12-21 Thread Nick Morgan
The technical ideas are fine, but I do not agree that they are the solution. And actually, in this case, pulling everything into one large global function will result in a one big function. Doing that just transfers the ball of mud from being global to being namespaced. No benefit is

Re: [JSMentors] JavaScript MVC is a good idea?

2010-12-21 Thread Acaz Souza Pereira
Hmmm, how this work in practice? The model will have a callback function? The model will refresh the view? Who will trigger the action to refresh the view? I did not know this other way of MVC in event-driven system 2010/12/21 Bryan Forbes br...@reigndropsfall.net -BEGIN PGP SIGNED

Re: [JSMentors] JavaScript MVC is a good idea?

2010-12-21 Thread Poetro
2010/12/22 Acaz Souza Pereira acazso...@gmail.com Hmmm, how this work in practice? The model will have a callback function? The model will refresh the view? Who will trigger the action to refresh the view? I did not know this other way of MVC in event-driven system Publish / subscribe

[JSMentors] Abort Image requests

2010-12-21 Thread Amit Agarwal
Hi, How to abort an Image request which is still on the fly? Example: var img = new Image(); var img.src = http://www.google.co.in/images/nav_logo29.png;; window.setTimeout(function(){ * //Code to abort/cancel image request if it hasn't triggered onload or onerror even after 20 seconds of

[JSMentors] Re: outsmarting the compiler?

2010-12-21 Thread jemptymethod
On Dec 19, 4:48 am, Szymon Piłkowski szymon.pilkow...@gmail.com wrote: Hello, So, we've got new javascript engines (v8/jagermonkey), which will use JIT compilers to do their magic and optimise performance of our core. The question is: should we still use our own magic to do the same job, or

[JSMentors] Re: JavaScript MVC is a good idea?

2010-12-21 Thread Justin Meyer
Acaz, That link is the old version of JavaScriptMVC. You can find the new one here: http://javascriptmvc.com/ . I develop JavaScriptMVC, but here's an attempt at a real and unbiased answer: The short answer: It depends on what you are doing and what you care about. For the long answer,

Re: [JSMentors] Re: Introductions

2010-12-21 Thread Joeri Sebrechts
Hi everyone, I suppose I'll introduce myself as well, and then I can go back to lurking. My name is Joeri Sebrechts. I'm currently the lead web developer for http://www.mcs.be , a Belgian company specializing in enterprise facility management software. (Just in case anyone from Belgium hangs out

Re: [JSMentors] Re: Javascript Pattern Nomenclature

2010-12-21 Thread Marc Harter
On Dec 21, 2010, at 2:02 PM, Thr4wn seth.a.b...@gmail.com wrote: So far I'm hearing that the module (or closure) pattern can have slow performance, so don't use it as a default. I love the closure pattern and think it's one of the reasons why JS is so powerful. So if it's between the

Re: [JSMentors] Re: outsmarting the compiler?

2010-12-21 Thread YANG Xudong
On Tue, Dec 21, 2010 at 20:54, jemptymethod jemptymet...@gmail.com wrote: What is out-smarting the compiler, really? I often get criticized for the following style of for loop: for (var i=0, n=arr.length; in; i++) On the grounds that I'm trying to outsmart the compiler. I'm certainly not

Re: [JSMentors] Re: Introductions

2010-12-21 Thread Anatoly Geyfman
Hey everyone, My name is Anatoly Geyfman. I am a web architect at medical imaging startup in Phoenix, AZ, DiCOM Grid (http://www.dicomgrid.com -- I had nothing to do with this website). I built our radiological web application and co-designed and developed the grid part of the application that

[JSMentors] Re: storing data: DOM or closure?

2010-12-21 Thread RobG
On Dec 21, 7:25 am, raysaun ray.s...@gmail.com wrote: I'm fairly new to JS with no formal training, but I try my best to be conscientious... I notice that in our code base lots of data gets shoved into the browser's DOM. Is that a good idea? For example, a component might perform an AJAX

Re: [JSMentors] Re: Performance of apply vs call

2010-12-21 Thread Shane Tomlinson
I am sorry for my accusatory email, I was having a rough day and put a tone to what I was reading that was inappropriate. Completely my fault. On Wed, Dec 22, 2010 at 12:40 AM, RobG rg...@iinet.net.au wrote: On Dec 22, 2:47 am, Shane Tomlinson set...@gmail.com wrote: Balazs, like I said, I

Re: [JSMentors] Re: storing data: DOM or closure?

2010-12-21 Thread Garrett Smith
On 12/21/10, RobG rg...@iinet.net.au wrote: On Dec 21, 7:25 am, raysaun ray.s...@gmail.com wrote: I'm fairly new to JS with no formal training, but I try my best to be conscientious... I notice that in our code base lots of data gets shoved into the browser's DOM. Is that a good idea? For