April 2nd, 2007 by Aaron N.
So over at Ajaxian today they have a post on Dean Edward’s latest update for his excellent packer javascript compression tool:
Dean Edwards has released Packer v3.0, one of the top utilities to squeeze your JavaScript like a lemon.
- respects Microsoft conditional comments
- new option to shrink variable and argument identifiers
- removed the special chars feature
(except the ;;; feature which people seem to like)
- some bug fixes:
- packer no longer closes spaces between the +/- operators so code like this is safe: c = a++ +b;
- the throw”error”} bug that affected Safari (this is a Safari bug really but packer gets around it)
- the __proto__ bug for Mozilla browsers (this only affected the online version of packer)
- a minor parsing bug affecting the detection of regular expressions
- simplified the user interface
Update:
The problems I outline below are fixed. Thanks Dean!
Unfortunately, I ran one of our libraries through it and found two issues that we’ll need to address before we can use it (luckly, I have a local copy of the previous version of the Packer…):
‘http://…’ breaks. Your packer wants this to be double quotes (“http://…”).
/*comment*//*followed by another comment*/ breaks. This happens in our code because we concatenate several files together and each file starts with comments and ends with comments.
I emailed Dean. Maybe he’ll have a fix. If not, we’ll have to figure something out or use the old one.
Posted in CNET JS Standards, Tools | 1 Comment »
March 20th, 2007 by Aaron N.
Another topic we’ve been discussing lately is unit testing. This is especially tricky when you’re writing code that requires a specific context, but even if we had an automated test for all our common libraries – which assume no such context – I think it would help dramatically. Here’s a recent post on Ajaxian about Squish, but, as noted in the post, Selenium seems to be the current favorite for this kind of task…
Squish for Web is a GUI testing tool aiming to be well suited for testing Ajax GUIs (and has special
support for many frameworks such as Backbase, dojo, ICEFaces, qooxdoo, JackBe, etc.)
The Squish for Web edition enables testing HTML-based Web and Web 2.0 (Ajax) applications in different web browsers running on different platforms.
Squish for Web is, unlike many available web testing tools, not restricted to a single web browser or platform. Squish for Web supports running and recording tests for web applications in Microsoft Internet Explorer, Mozilla, Firefox, Apple’s Safari and KDE’s Konqueror on Windows, Linux, Unix and Mac OS X.
Demos
Selenium seems to be the de facto standard these days, but we can always do with new tools to help us test. What do you use?
Posted in Best Practices, CNET JS Standards, Tools | Comments Off
March 14th, 2007 by Aaron N.
Valerio posted over on the Mootools forums today a list of changes in the upcoming 1.1 version of mootools. We’ve been hard at work on a lot of this stuff and I’m excited to see it come out. After this version, we anticipate working less on the core framework and more on plugins and widgets.
————————————————————————————————————
#Additions
————————————————————————————————————
- CUSTOM EVENTS!
- $each also iterates objects
- added Element::getStyles
- added Element::hasChild
- added Array::include
- added Array::merge
- added $merge, to merge objects
- Dom.js uses XPATH in supporting browsers
- the use of +’px’ in setStyle is not required anymore.
- added XHR::cancel
————————————————————————————————————
#Changes
————————————————————————————————————
- Object.extend is now $extend, still compatible
- Object.native is now $native, still compatible
- Element has been splitted in Element.Events, Element.Form, Element.Dimensions
————————————————————————————————————
#Elements Creation
————————————————————————————————————
- elements creation is easier: new Element accepts second param
- elements creation for elements with name/type is easier, just use second argument.
- setProperty for name/type are is supported anymore.
————————————————————————————————————
#Notable Fixes
————————————————————————————————————
- dom logic is highly optimized and its blazing fast
- better sortables, no more flickering, removed Drag dependency
- Fx.Slide now accepts borders and margins. Positioning is now possible.
- Element::toQueryString in ajax now works as intended with all Form elements, including multiple selects.
- Element::setStyle supports float
- Element::setProperty and Element::getProperty now supports “for”
————————————————————————————————————
#Obvious Things
————————————————————————————————————
- code cleanup and optimization
- bugs and incompatbilities fixed
- mootools is faster, FASTER, FAAASTEEERRR
————————————————————————————————————
#TODO
————————————————————————————————————
- some bugs left
- testing
- css3 selectors (?)
- ???
Posted in 'Industry' News, CNET JS Standards, MooTools, Uncategorized | 1 Comment »
March 8th, 2007 by Aaron N.
Part of writing clean code that doesn’t cause you grief in esoteric browsers is doing the best you can to ensure that your code is completely syntactically valid. My pal Valerio (principle author of Mootools) pointed out how to turn on strict warnings, which I couldn’t get to show up in Firebug, even though I enabled them there.
The problem turned out to be the excellent Web Developer Toolbar which, if you haven’t installed, you should.
The issue is that the default setting in Disable > Javascript > Strict Warnings is to suppress these errors, so even if you enable them in Firebug, you won’t see them. You have to enable them in both places. Read the rest of this entry »
Posted in Best Practices, Browser Plugins, CNET JS Standards, Reference | 3 Comments »
February 23rd, 2007 by Aaron N.
There are several new goodies in the most recent release of the CNET libraries. I’ve got examples and details in the wikitorial, but here’s a quick list:
- JsonP – handles grabbing Json from a foreign domain; works a lot like Ajax
- Element.smoothShow/smoothHide – a height/opacity transition for an element to add it to the page smoothly.
- Element.setPosition – position an element relative to another (the window or another dom element)
- ProductPicker – a generic “picker” to allow users (typically in a CMS) to choose an item from a data source.
- stickyWinHTML – a default html block for in-page popups
- SimpleSlideShow – a very, very simple slideshow for dom elements or images
Have fun.
Posted in CNET JS Standards, Examples, Widgets | Comments Off
February 23rd, 2007 by Aaron N.
Hi gang,
I’ve set up an svn server at Google code to host all our “common” or “public” libraries. This is so you can keep up to date with the files as we fix bugs and whatnot. CNET has it’s own internal source control, but it’s behind our firewall. Rather than go through the trouble of setting up an external server for our libraries, I’m just using Google’s stuff.
In addition to this, I’ve broken up the libraries into chunks so you can download all the little files, or you can download just our extensions in a group. It’s not as fancy as Valerio’s document builder, but it’ll have to do.
Note that our libraries are working off the development version of Mootools, so if you are using 1.0 you may find that some of our functions don’t work. I’ve included in the SVN our copy of Mootools, which will work with all our extensions. This copy is likely a few revisions behind the dev version.
Posted in CNET JS Standards | Comments Off
February 12th, 2007 by Aaron N.
I ran a pass through our reporting software the other day and here’s the breakdown of browser usage @ CNET. It’s not in a fancy chart because I don’t have time for that kind of thing, but I’m sure you’ll manage:
OS:
92.3 % Windows
6.8% Mac
0.4% Linux
Browser:
Firefox: 23%
MSIE: 71%
Safari: 4%
MSIE:
55.9% ver. 6
43.5% ver.7
Summary:
Firefox has made some strides but continues to be an underdog. Safari is only barely big enough to even worry about supporting it (though of course we do). IE7 has made a lot of headway since it’s launch, but IE6 is still the winner (sigh) with near 40% of the total market. No other browsers cracked the 1% mark.
It’s scary that .6% of our IE users are still using version 5 (dear god why?!?) and .1% of them are using IE 4. These people, presumably, were stranded on an island after their plane crashed. There they found a fall-out shelter with a computer that requires you to click a button every 108 minutes. This button reads “object expected in line 12.”
Posted in CNET JS Standards, Reference | Comments Off
February 6th, 2007 by Aaron N.
Thought I’d drop a note that there are a few bug fixes in the CNET common libraries that are worth downloading if you’re using our stuff.
- Modalizer – The overlay div that it creates has to be larger than the window space (only slightly). In IE, it eats memory when you create a div this large that is semi-transparent. Before I would create a new overlay every time you instantiated Modalizer, but now I reuse the layer. Note that it doesn’t leak this memory. As soon as you reload the page or browse elsewhere you get it back.
- string.cnet.js – re-implemented String.replaceAll() because String.replace(old, new, “ig”) doesn’t work in, you guessed it, IE. In IE, it would seem that you can’t pass in that third option (the regex options). If you want to replace something globally you have to do String.replace(/old/ig, new). String.replaceAll() does this for you (and lets you pass in regex options as a third and optional argument).
- StickyWinModal – this was calling the wrong hide method for the StickyWin instance and the result was that the iframe shim was left behind on the page.
Posted in CNET JS Standards | Comments Off
January 30th, 2007 by Aaron N.
Mootools 1.0 is out. Fancy new site design and docs.
We’ve already refactored all our code for 1.0, though it is not yet released to the CNET site. We’re entering into QA now…
I’ve also released the second part of my wiki tutorial series, this time giving working examples of all the CNET common code. The CNET Libraries are comprised of common code (widgets, shortcuts, etc.) and implementation code – code that is specific to a given page or application. The implementation code is usually just implementing and executing functions and libraries in the common portion of the library. The wikitorial for the CNET common code focuses on this generic content. Form validation, date pickers, carousels, etc. Dig in! Oh, and if you have a chance, Digg the tutorials, too. You’ll find shortcuts to do that in the right navigation column in the tutorials.
Posted in Ajax, CNET JS Standards, Event Scripting, Examples, Manipulating the Dom, MooTools, Reference, Visual Effects | Comments Off
January 12th, 2007 by Aaron N.
Just this morning I was pinging Valerio (author of Mootools) about a cheat sheet for Mootools after Snook posted his updated cheat sheet for Prototype 1.5. Funny thing; Snook posted a Mootools cheat sheet yesterday and it just hadn’t gotten to my inbox yet. Go Snook! I’m going to add this to our cvs library along with all our other docs and whatnot.
In the same vein as the Prototype Cheat Sheet, I decided to go through and detail the Mootools library, as well. In comparison to Prototype, Mootools is definitely smaller and it’s obvious they’ve put more focus on interactivity and decent DOM traversing.
I’ve colour-coded this one to match the four main categories that are in the download section of the web site and within the documentation. This way, it should hopefully be clearer when trying to compare against the two.
In going through things, I noticed that the documentation for Mootools isn’t bad but spelling mistakes and what not have meant that a couple features aren’t actually detailed in the documentation.
Anyways, for you Mootool luvin’ fans, here are the cheat sheets:
Posted in CNET JS Standards, MooTools, Reference | 2 Comments »