Hi WebYaST hackers,
Yesterday I fixed this JavaScript browser detection bug:
https://bugzilla.novell.com/show_bug.cgi?id=529931
and just wanted to tell you my observations.
We spend a lot of time writing good, clean, DRY, easily readable ruby code and
even have tools like Flog, Flay and Heckle(1) to check its quality. All this
is great, sure.
But on the other hand we just dump JavaScript code into the users browser to
do some magic but don't care for quality there.
The bug above was just 4 tests if a variable had a value.
Here's a diff snippet:
- window.G_vmlCanvasManager.init_(document);
+ if (window.G_vmlCanvasManager) {
+ window.G_vmlCanvasManager.init_(document);
+ }
My JavaScript debugger(2) still gets flooded with warnings about the code that
we run in the users browser. So there might arise other stuff in the future.
Somehow this feels strange. Focussing on good code on the one side but
forgettig about it on the other.
(1)
http://ruby.sadi.st/Ruby_Sadist.html
(2)
Web Developer plugin for Firefox:
https://addons.mozilla.org/en-US/firefox/addon/60
I also recommend Firebug:
https://addons.mozilla.org/en-US/firefox/addon/1843
Ciao,
Daniel
--
J. Daniel Schmidt