Wednesday, 27 August 2008
John Resig:
"One thing has always annoyed me about the script tag. Script tags that reference external resources (via the src attribute) are no longer able to execute script embedded within the tag itself."
This has always bugged me, but I've never been able to come up with a good solution. I think John is really creating some good mojo with this post, and I'm fascinated to see whether we, as a community, can come up with a good pattern to make this type of script tag use work, and make it work well.
Tuesday, 26 August 2008
Chris Eidhof:
"Arrows are a concept from functional programming, and we'll see how they can make our life in Javascript a lot easier. Our code uses the excellent Arrowlets library. It's still alpha code, but it's already quite useful."
What an odd title. It seems like the entire idea of this method is to use callbacks. I wish I knew what the author meant by his title.
Anyway, an interesting look into a different way of doing functional programming with JavaScript.
Thursday, 21 August 2008
Aug. 21, 2008
One of my absolute favorite parts (other than Alex's foreword) of Matthew Russell's Dojo: The Definitive Guide is a warning in the Toolkit Overview chapter that reads:
"Viewing an API call as 'worthless' may be an indication that you may be confused about the exact utility that the call provides. Whenever this happens, review the documentation to find out what it is you're missing. If the documentation still doesn't convince you, hop on a mailing list or IRC channel and ask someone about it."
One of the reasons he mentions this is that he's just covered Dojo's dojo.byId function. While the function is shorter and easier to remember than document.getElementById it also smooths out a browser inconsistency. Shockingly, this inconsistency happens in Internet Explorer.
JavaScript toolkits fix this by doing a couple of clever things. FIrst, you can just use document.getElementById to get the element. You then do a lookup to make sure the returned node really has that id. You can't simply do a node.id check though, since if the returned element is a form, node.id might return an input node within that form (eg a text input field with name="id"). Your check, then, should be (node.id.value == id). If the node you received through document.getElementById doesn't pass this test, then use document.all[id] to get an array of nodes, and look through these for the first one that passes the test.
Wednesday, 13 August 2008
Eric Wendelin:
"Chances are that if you've done any significant Javascript work, you've run into a situation where part of the debugging process could be much improved if you just had the function call stack.
"I'm going to give you some ways of doing this with and without the popular Firebug extension and have some examples of their uses."
This seems to work, and I'd like for the community to take ahold of it. It would be fancy to be able to have a valid console.trace(); in Firebug Lite.
Monday, 11 August 2008
Karl Tiedt:
"Have you ever found a widget that does almost *everything* you need, yet you still manage to find some small thing that needs to be done differently? Ever cringe at the thought of having to extend a widget to add 5 or 10 lines of code to it? In the past, thats what you had to do... well unless you were really gung-ho and wanted to write your own from scratch."
It's meant to be a cookie, so it's meant to be short and sweet, but I might as well use this as an opportunity to build on that.
First of all, this will work with any class-type object that can accept a property and a node as its two parameters and not barf. Overall, the point of DojoML has always been prototyping. Being able to prototype a change to the way a widget (or any object) works inline is really nice.
Secondly, and as much as I say this, it doesn't seem to get understood, this whole pattern is functionally equivalent to creating a function that:
-
Creates a new instance of a widget
-
Uses dojo.connect, or a direct override to change its functionalitty
-
Returns that instance
In JavaScript, a constructor function can return whatever it wants, so you can use it as an adapter, which is totally possible here.
Mark Hayes:
"However, we took a different approach to dispatching events: instead of using synthetic events, we used the cross-browser and cross-platform Java applet technology to place real events on the native event queue, as if a real person performed the action. This means that when you use doh.robot to execute your unit tests, browsers will trust the events doh.robot creates from your commands and will handle any and all contingent events for you. So when you tell doh.robot to send a Tab keypress, you can fully expect the Tab to move focus to the next element in the Tab order, as if a real user pressed Tab. And when you tell doh.robot to click an element, you can fully expect to get the onmouseover before the onmousedown, as well as all of those hundreds of onmousemoves a real user would generate in between. When you use the DOH test runner in conjunction with doh.robot, you can easily automate and report the results of numerous accessibility and UI unit tests that would otherwise require manual, visual inspection by a real person."
Looks pretty sweet, I've always been skeptical of (and had trouble with) the UI testers that synthesized events. I think the API needs a little help, but I expect this to be huge over the next few months. Dojo is really offering a lot of well engineered features.
south tutorial:
"With South, you install it and then give one or more of your apps some migrations (either writing them by hand, or autogenerating them from your model definitions). When you syncdb, you'll only sync apps that don't have migrations (things like django.contrib.auth, for example, which have a fixed schema), and then when you run ./manage.py migrate, South kicks in and does the migrations. Intelligently."
The first database migration tool for Django that I think has a future, I plan to start messing around with this in my personal projects.
Alex Russeell:
"On this point the essay also contains a rhetorical bait-and-switch which I find distasteful: it dismisses variables because they don't inherently do anything to reduce the lengths of pages (true!) and then argues against macros and inheritance because they create levels of indirection which can be confusing. Inheritance and macro definitions can play a key role in drastically reducing the length of style sheets. In this way, they promote understanding through exactly the same 'memory effect' mechanism that is cited as a liability when discussing variables."
I love the way that Alex has so calmly ripped apart the half-hearted arguments that have been a more an more frequent occurrence from members of standards bodies.
Lately, I've been amazed by some of the attitudes arising from people that aren't "in the trenches" of web development, but still feel like they have something of a valid opinion to offer. I appreciate that we have people like David Flannagan have reached out to the community, acknowledging that although they have a deep technical knowledge of a subject, they can be out of touch with its actual use. There needs to be more of this.
While reading about search engine optimization, I found out that Google factors this site in when doing ranking. I then found the JavaScript developers personal pages category. Lots of good names on there, I encourage you to add yours as well!
Monday, 4 August 2008
Neil Roberts (me):
"All the security policies that browser enforces remain in effect using this technique. In fact, the only data that gets exchanged between the two sites involved in the transaction is the data that each site explicitly assigns to what is technically nothing more than a shared variable."
I wrote this article after getting a little frustrated at how complicated authentication schemes are in JavaScript. The library is tiny, and can be used by any site that wants to provide JavaScript access to their API.
David Flanagan:
"Class() -- a utility function for defining JavaScript classes."
Yet another attempt at treating JavaScript as something that it's not. The comments are worth reading even moreso than the article. I'm hoping that we'll be able to get away from some of the current attitudes that stand opposed to really great functional programming, and I have some ideas in the works that I hope will help.
Kevin Yank:
"Every major browser has introduced new development tools that make it easier to diagnose problems with your HTML, CSS, and JavaScript code right inside the browser in question."
I'm really excited to see some of the stuff coming up in Safari. A good overview for those of you that aren't experienced with all the options out there.
|