Aleksandar • Vacić

iOS bits and pieces

innerHTML kills event handlers

This is probably old news to regular Javascript coders, but for me it was an ugly bite. I have renewed my interest in JS with the abundance of libraries springing up and started coding few solid client side interfaces in the office.

A certain interface was previously built in a hurry and HTML code was littered with plenty onclick="somefunction()" code. I re-factored all of that so that handlers were added on DOM.load; however, there was one nasty feature left in the code.

I had a table of 6 rows and button which that says “Add line”. Adding lines is easy: create the whole table row HTML on server, fetch that with XHR call and do tbody.innerHTML += sRow. Actually, this was the code I used for IE and as soon as this is done, all the previously set event handlers went missing. Like they never existed.

Bottom line: changing innerHTML property removes all late-bound event handlers and script on that piece of the page.

Solution was to get off my lazy fingers and type in proper DOM calls: insertRow and insertCell. Clean code and no browser branching. :)

Sony SZ1XP/C: battery problem resolved

In my review of this notebook, I mentioned that battery died rather quickly after being purchased, which was very unfortunate for me as my warranty was not valid in Serbia (Sony is not selling notebooks here).

At the end of January, I finally had a chance to go to UK, for four days. As soon as I got there, I called Sony support numbers and got online with CS guy who was a pleasure to talk to. After hearing reports that other companies are using off-shore CS, it was nice hearing a person speaking excellent english.


Exhibit A:Apple Hungary site stopped listing Cinema Displays. This is fairly strong Apple store in the region.

Exhibit B: A larger than usual boot taken by Apple at NAB

It’s about time for new displays.

It starts

The first race without M. Schumacher and the F1 continues where it left off in 2005: Raikkonen vs Alonso. Coupled with Massa and Hamilton, this looks to be a battle between McLaren and Ferrari once again. Granted that BMW looks good, I think these two teams will be at the centerpiece of the battle.

Ferrari is, without any doubt, a class of its own at the moment. No one could even come close to Kimi and if it wasn’t for mechanical problems in the second Ferrari, this would’ve been 1-2 for them. Alonso was as good as to be expected but my impression of the day is immensely happy Lewis Hamilton in the 3rd position. Fantastic race debut for him with just two minor mistakes.

A good start of the season, things will only get better.