This blog has been retired, new updates are happening at http://josephscott.org/
0

Prototype Finds a Home

Posted on January 18th, 2007 / Comments Off
Tags: ,

The Javascript library framework Prototype has a new home at Prototypejs.org. With API docs, tutorials and a blog.

Oh, and version 1.5.0 of Prototype is now available for download

1

Checking Out jQuery

Posted on September 11th, 2006 / 1 Comment »
Tags: , , , ,

I’ve been reading through some of the jQuery docs and I’m getting more and more interested. I’m aware of mootools (and Jonathan’s drag and drop example) and the latest updates to prototype. I hope to get around to playing with those as well.

The compressed version of jQuery comes in at impressive 17,587 bytes. I do wonder if there is any slow down in performance. Either way, it is a huge leap from the 45,778 byte uncompressed version of jQuery.

Ryan Campbell investigates the cost of enumerable loops in Prototype. The resulting numbers are pretty dramatic when dealing with larger arrays. One thing to keep in mind though is that for only a few iterations over arrays with a small number of elements then the penalty is probably small enough that it won’t cause problems.

Benchmarks using the various JavaScript libraries is something that I’d expect to see more of. Soon or later someone will post benchmarks between Prototype, YUI and JQuery on various tests. The benefit from having numbers like this is that eventually all libraries will adopt the fastest approach that meets their goals.

I’ve been getting lots of great feedback on Edit In Place. As time permits I hope to fix problems and round out the feature set a bit more. To that end I’ve rolled out version 0.2.1. Here’s a list of what has changed since version 0.2.0:

  • The bundled version of Prototype is now 1.5.0_rc0. This was mostly to make sure that my code still worked with 1.5.0_rc0.
  • Attempt to deal with editing, updating and saving empty strings in a reasonable way

I’ve updated the example page to include editing a string that starts out empty. The example now has a link to my Edit In Place blog entries, the edit.php source (assuming your web server knows what to do with .phps files) and the main link at the top now goes http://josephscott.org/code/js/eip/.

Two new options have been introduced to format empty strings: empty (which is the css class to apply to empty strings, defaults to .eip_empty) and empty_text (the text to put in place of empty strings, defaults to ‘Click To Edit’). These options are valid for all types (text and textarea).

So go to the example page and click on the grey ‘Click To Edit’ string and you’ll get an empty text box. Type in something and you’ll get the new string instead. Then delete the string and you’ll get the grey ‘Click To Edit’ string again. You can do the same thing with the original text and textarea examples.

I think that I’ve covered the empty string condition, but if you find a bug please drop me a note. Include a patch if you are really feeling generous :-)

0

I’m Sold on Prototype

Posted on February 16th, 2006 / Comments Off
Tags: , , ,

For years I avoided Javascript as much as possible. It was a pain to try and support all of the versions of Internet Explorer (IE) and Netscape Navigator. It just was not worth it. As time went on my aversion to Javascript lessened, but I never made the effort to really learn it as a language. I would learn just enough to accomplish a small specific task.

Fast forward to 2005/2006. AJAX has become the buzzword of choice. Some smart folks have learned to deal with most/many of the issues that are still there between IE and (now) Firefox. This has given rise to Javascript libraries, with Prototype being one of the more popular.

After a few brief attempts trying to figure out how to do something useful in Javascript with Prototype I figured my lack of real Javascript skills were just not up to the job. Then Yahoo came out with their Yahoo! User Interface Library (YUI), which got me thinking about Prototype again. After reading through more examples and documentation I was finally able to accomplish exactly what I wanted.

I’m now sold on using Prototype. Sam Stephenson deserves heaps of praise. To help out others who are looking for documentation and examples, here is a list of resources for Prototype.

While trying to debug AJAX I recommend using the Firefox plugin called FireBug. Turn on the “XMLHttpRequest Spy” feature and you’ll be able to monitor all of the AJAX transactions that are going on.

Of course Prototype isn’t perfect, there are still important limitations and issues to keep in mind. For instance, the target platforms for Prototype are (from the README):

Microsoft Internet Explorer for Windows, version 6.0 and higher
Mozilla Firefox 1.0/Mozilla 1.7 and higher
Apple Safari 1.2 and higher

I’m also curious to see how it stacks up against the new Yahoo User Interface Library. Either way this is an exciting time in the land of Javascript.

Ads