Bugfixing for gWidgets for use with prototype

gWidgets is a really nice library of widgets. I have been using it for some time with success, gTabs especially.

A friend of mine ktolis who has been using the new Safari browser and Firefox 3 beta told me that the tabs wouldn’t appear because of javascript errors.

It has been concluded now that the errors were caused by 2 factors Firefox3 and Safari (that both implement HTML 5) and the fact i have been using latest prototype library

Javascript errors appeared in lines 232, 299, 448 and 528 of gwidgets.js saying that ‘each is not a function’.

Then i found this post: document.getElementsByClassName

According to the above post in new browsers, implementing html 5, ‘each’ is not implemented on the array returned by document.getElementsByClassName() because getElementsByClassName is implemented by the browser and not prototype any more(for prototype 1.6 and newer that is). So i simply replaced document.getElementsByClassName(blahblah).each occurencies in gwidgets.js with for loops to iterate the returned array. The errors stoped after this.

Also i would like to mention another fix concerning a css problem with gTabs , where if the text inside the tab is quite large the tab doesn’t resize. If you comment line 95 in gwidgets.css the tabs can be resized to fit their content.