Testing all versions of IE, and almost enjoying it at the same time.
Testing web pages in multiple versions of IE is the part of my work that makes me wish I had geared my career towards toilet cleaning. Recently I discovered this little gem: IE Tester .

This makes testing different versions of IE a breeze, and you can easily see how crappy your pages look in IE6.
Enjoy!
jsbeautifier.org vs Visual Studio 2008 1 – 0
JavaScript formatting in VS2008, sigh…
I just had a bad experience with VS2008. I wanted to make a minified JS-file more readable so I thought why not use ctrl-k,ctrl-d which always produces nicely formatted code. This is true for smaller size documents, I was editing ext-all.js which is 500kb of minified JS. Result? IDE completely hung for > 5 minutes. During that time I visited http://jsbeautifier.org/ and let it have a go. Result? 12 seconds. And that’s in-browser formatting, just javascript.
jsbeautifier.org vs Visual Studio 2008 1 – 0
Back to work…
Nice video on HTML5 on Youtubes
Just stumbled upon this nice introduction to HTML5 from September 2008. Ian Hickson shows lots of interesting examples of new things you can do with HTML5. Features covered include: video tag, local storage, session storage, canvas, cross frame messaging, drag n drop, widgets (date input, range input, validation etc) and more…
If that’s not enough, here’s another HTML5 video from Google I/O 2009.
Ext 3.0 final getting closer
As seen in a forum post by Aaron Conran, the final release of 3.0 will take place next Monday. There’s also another RC being released tomorrow. Happy times!
New Ext Core menu widget: FingerMenu
Ext Core recently got out of beta which is pretty great. I wanted to check it out a bit more and create a basic menu widget too. Here is the result, turns out it wasn’t hard at all. Not sure how useful or user friendly this menu is, any comments?
To start out, I use Observable as my base class since I want the “owner” of the menu to be notified of the menu change event. In the constructor I create a containing div as well as one div/span for each of the items supplied in the items array of the config object. In the end, the DomHelper is handed one big specification object, very simple indeed. After creating the elements I register a click listener on the containing element. This listener is just called when a click happens on a div element, which is specified by the last argument of the function call.
this.el.on('click', this.onItemClick, this, { delegate: 'div' });
This concept is called event delegation which is another nice feature Ext Core helps you with, gotta love the powerful one-liners
.
Here’s the full source code, go here to download the example and source:
/*
The MIT License
Copyright (c) 2009 Mats Bryntse
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* Ext.ux.FingerMenu
*
* @author Mats Bryntse
* @version 1.0
*
* This menu fires a 'change' event when an item is activated
*
*/
Ext.ns('Ext.ux');
Ext.ux.FingerMenu = Ext.extend(Ext.util.Observable, {
/*
* @cfg (array) array of menu config objects
* The menu is built for 32x32 icons, if you need different size icons
* you'll have to modify the CSS.
*
* Example object :
* {
* text : 'Menu item 1',
* iconCls : 'myIconClass',
* tooltip : 'This option is optional'
* }
*
*/
items : [],
/*
* @cfg (int) selected menu index
*/
selectedIndex : 0,
/*
* @cfg (int) the X position of a selected menu item
*/
expandedX: 0,
/*
* @cfg (int) the X position of the collapsed menu items
*/
collapsedX : -150,
/*
* @cfg (int) the X position of a menu item on hover
*/
hoverX : -147,
/*
* @public (int) returns the currently selected item index
*/
getSelectedIndex : function() {
return this.selectedIndex;
},
/*
* @private
*/
onItemClick : function(e, t) {
var target = Ext.get(t);
if (!target.hasClass('fingermenu-show')){
var current = this.el.child('.fingermenu-show');
target.radioClass('fingermenu-show');
current.setX(this.collapsedX, {
duration : 0.3
});
target.setX(this.expandedX, {
duration : 0.3,
callback : function() {
this.selectedIndex = parseInt(t.id.substring('menuitem-'.length), 10);
this.fireEvent.defer(10, this, ['change', this, this.selectedIndex]);
},
scope : this
});
}
},
/*
* @private
*/
onHover : function(e, t) {
var target = Ext.get(t);
target = target.is('div') ? target : target.up('div');
if (target.getX() === this.collapsedX){
target.setX(this.hoverX, {
duration : 0.1
});
}
},
/*
* @private
*/
onHoverLeave : function(e, t) {
var target = Ext.get(t);
target = target.is('div') ? target : target.up('div');
if (!target.hasClass('fingermenu-show')){
target.setX(this.collapsedX,{
duration : 0.2
});
}
},
/*
* @private
*/
constructor : function(config) {
if (!config || !config.items) throw 'Invalid arguments, see documentation';
Ext.apply(this, config);
var tabCfg = {
tag: 'div',
cls: 'fingermenu-panel ' + (config.cls || ''),
children : []
},
items = config.items,
item,
selected,
i;
this.addEvents('change');
for (i = 0; i < items.length; i++) {
item = items[i];
selected = (i === this.selectedIndex);
tabCfg.children.push({
id : 'menuitem-' + i,
cls : selected ? 'fingermenu-show' : '',
style : {
width : '190px',
position : 'absolute',
left : (selected ? this.expandedX : this.collapsedX) + 'px',
top : (i*42) + 'px'
},
tag: 'div', children : [{
tag : 'span',
cls : item.iconCls ? ('fingermenu-icon ' + item.iconCls) : '',
html : item.text,
title : item.tooltip || item.text
}
]
});
}
this.el = Ext.DomHelper.append(Ext.getBody(), tabCfg, true);
this.el.on('click', this.onItemClick, this, { delegate: 'div' });
var divs = this.el.select('div');
divs.on('mouseenter', this.onHover, this);
divs.on('mouseleave', this.onHoverLeave, this);
Ext.ux.FingerMenu.superclass.constructor.call(this);
}
});
“We recommend using Internet Explorer version 6 or below”
Never thought I’d see that text on a serious webpage. But yet here it is:
Some clients are currently experiencing a page navigation error when completing the first page of their eVisa application. In some instances this may be due to clients using Internet Explorer version 8.
We recommend using Internet Explorer version 6 or below. Additional information on supported browsers is available.
Not bad…
Trying to combine Ext Core and JQuery idTabs extension
Don’t ask me why but I was playing around with Ext Core and JQuery idTabs when I had some weird errors. I kept getting errors inside the Ext Core array “remove” augmentation.
Ext.applyIf(Array.prototype, {
indexOf : function(o){
for (var i = 0, len = this.length; i < len; i++){
if(this[i] == o) return i;
}
return -1;
},
remove : function(o){
var index = this.indexOf(o);
if(index != -1){
this.splice(index, 1);
}
return this;
}
});</code>
I couldn’t understand why I ended up there until I had a look at the idTabs code below (aList is an array).
for(i in aList) $(aList[i]).removeClass(s.selected);
Here’s the culprit: Iterating an array using for in. A better way to do it would be to use a for loop, or to check hasOwnProperty for each property. This way you’re protected if an external framework should augment the native Array object. I prefer using for loops when iterating over arrays.
Diffing files in TFS
Diffing files in TFS is just as horrible as you would expect it to be. Luckily you can plug in your own diff tool, as described here. I really like Beyond Compare, which currently costs 50$ for a single dev license.
ExtJS 3.0 RC1 is out!
New live examples at http://extjs.com/deploy/ext-3.0-rc1/examples/
It really looks great and I particularly like the Row Editor sample, very nice touch.
Download it here
Following the Ext conference through Twitter
Since I couldn’t go to the Ext conference I had to settle for the 124312512th best thing, following it through Twitter (link to #extconf @ Hashtags.org). It pretty much stinks to be honest. But something good came out of it believe it or not…

Looking forward to those videos!

6 comments