Prev: Outstandingly excellent JS drag-and-drop tutorial with working code
Next: Number list to display in the slide show
From: pete on 25 Jun 2010 19:15 Hi folks -- It's concise, it's comprehensible, it's complete, and it's correct; a thing of beauty: http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx I'm a JS beginner and I'd been trying for a year to get d-n-d working using other tutorials. This is the only one I can understand and use directly, very near to 100% cut-and-paste. The very acme, model, and paradigm of tutorials. imho, of course. -- pete
From: Thomas 'PointedEars' Lahn on 26 Jun 2010 05:10 pete wrote: > It's concise, it's comprehensible, it's complete, and it's correct; a > thing of beauty: > > http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx It is nowhere close. A *requirement* for global variables, "IE is retarded" instead of an explanation of different DOMs, proprietary event-handler attributes, `$' functions, unncessary `innerHTML', no feature tests whatsoever, disregard for left-handed mice, Prototype.js recommendation. Save your money. And you want to stop recommending it. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: pete on 27 Jun 2010 14:25 On Jun 26, 5:10 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > pete wrote: > > It's concise, it's comprehensible, it's complete, and it's correct; a > > thing of beauty: > > > http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx > > It is nowhere close. A *requirement* for global variables, "IE is retarded" > instead of an explanation of different DOMs, proprietary event-handler > attributes, `$' functions, unncessary `innerHTML', no feature tests > whatsoever, disregard for left-handed mice, Prototype.js recommendation. > Save your money. > > PointedEars lmao! I gotta' admit it, PE; you are unique, a very Platonic ideal unto yourself. Thanks for pointing out these shortcomings. They are points that further my JS education. For example, I've been too dense to grok that code that handles multiple interdependent events need have no globals; I'll be on the lookout for some of that globals-free code. And I've seen hundreds of posts in this group that list in detail the retardations of IE, so I don't agree that every further post that criticizes IE has to rehash those IE issues. And I still don't see where the writer recommends Prototype.js; I thought instead that he picked up some useful Prototype.js code, and good on him for that. But hold. This is of course all just me and my petty cavils. Canards, too. I do appreciate your taking the time to respond in detail: thank you so much again. > And you want to stop recommending it. Well, I dunno. I believe that IF: 1. one is a Javascript developer; and 2. one wants/needs to include some easy drag-and-drop JS code in one's app; and 3. one doesn't have the know-how to implement such code from scratch; and 4. one has been discouraged by the opacity of earlier d-n-d tutorials; and 5. one can put up with the putative shortcomings that Pointed Ears rags on above THEN: One could do no better, impo, than to consider the tut at http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx Best to all, -- pete
From: Garrett Smith on 27 Jun 2010 15:09 On 2010-06-27 11:25 AM, pete wrote: > On Jun 26, 5:10 am, Thomas 'PointedEars' Lahn<PointedE...(a)web.de> > wrote: >> pete wrote: >>> It's concise, it's comprehensible, it's complete, and it's correct; a >>> thing of beauty: >> [...] > One could do no better, impo, than to consider the tut at > Better is relative and even the best can do better. > http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx > You could, for example, think about it critically, asking what's wrong with this? and then in the recommendation, you could also list those things. You can also list things that were unclear or questionable, such as: "I saw a comment about a bug in Safari but I couldn't reproduce that." Garrett
From: RobG on 27 Jun 2010 22:50
On Jun 28, 4:25 am, pete <pete...(a)yahoo.com> wrote: > On Jun 26, 5:10 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> > wrote: > > > pete wrote: > > > It's concise, it's comprehensible, it's complete, and it's correct; a > > > thing of beauty: > > > > http://luke.breuer.com/tutorial/javascript-drag-and-drop-tutorial.aspx > > > It is nowhere close. A *requirement* for global variables, "IE is retarded" > > instead of an explanation of different DOMs, proprietary event-handler > > attributes, `$' functions, unncessary `innerHTML', no feature tests > > whatsoever, disregard for left-handed mice, Prototype.js recommendation. > > Save your money. > > > PointedEars > > lmao! I gotta' admit it, PE; you are unique, a very Platonic ideal > unto yourself. Thanks for pointing out these shortcomings. They are > points that further my JS education. Good. > For example, I've been too dense to grok that code that handles > multiple interdependent events need have no globals; I'll be on the > lookout for some of that globals-free code. Follow the link in the article to the QuirksMode example - look ma, no globals. If you want to know more about how to avoid global variables, read up on the module pattern and private and public members in javascript. Here's a couple to get you going: <URL: http://michaux.ca/articles/module-pattern-provides-no-privacy-at-least-not-in-javascript-tm > <URL: http://michaux.ca/articles/an-important-pair-of-parens > About closures in detail: <URL: http://jibbering.com/faq/notes/closures/ > While you're reading about and playing with closures, come back here and ask questions, I'm sure you'll have plenty. > And I've seen hundreds of > posts in this group that list in detail the retardations of IE, so I > don't agree that every further post that criticizes IE has to rehash > those IE issues. You are referencing an article, not a post here. It is unreasonable to expect that everyone who reads that article is even aware of this group, much less of posts here about various browser differences and how they might apply to a drag and drop library. Statements like: | // IE is retarded and doesn't pass the event object are unnecessarily unprofessional, simply remove the second to fourth words inclusive and you have a much more professional comment (and don't appear to be ignorant of how the various event models evolved at the same time). The language of other code comments is quite reasonable. > And I still don't see where the writer recommends > Prototype.js; I thought instead that he picked up some useful > Prototype.js code, and good on him for that. "Useful" depends on your point of view - Position.js uses user agent based browser sniffing and has an "isOpera" function, so at least some of it can be improved upon. The code in the article has a $() function that simply calls document.getElementById() and is used precisely once. So to save typing 22 characters, the author wrote a function of 53 characters and spaces (plus a bunch more for the comment). Consider using instead: var $ = document.getElementById; within the scope it is required. No global "$", no extra function call, far fewer characters to transmit and exactly (more or less) the same functionality. [...] > I do appreciate your taking the time to respond in detail: thank you > so much again. > > > And you want to stop recommending it. > > Well, I dunno. I believe that IF: > > 1. one is a Javascript developer; and > 2. one wants/needs to include some easy drag-and-drop JS code in one's > app; and The code has basic drag functionality, but no "drop" functionality as would be expected by a javascript developer looking for a drag-n- *drop* tutorial. Where is the notification to other elements that a dragged element has just been dropped on them? Or passed over/under/ through them? > 3. one doesn't have the know-how to implement such code from scratch; > and From the article, they are still ignorant about the dropping bit. > 4. one has been discouraged by the opacity of earlier d-n-d tutorials; > and > 5. one can put up with the putative shortcomings that Pointed Ears > rags on above And the lack of half the claimed functionality. If you want comments on an article, it is best to simply ask for a review. There must have been thousands of similar articles written over the years, there is probably far more benefit to the author in writing them than to the reader in reading them. Likely the author learned a lot in writing the article, but his education is not complete (and likely never will be in regard to javascript). -- Rob |