This is a short one but really odd.
Scenario:
Have a table with tbody element, have an ajax provider that dynamically generates rows for this tbody, pretty simple.
Ajax request (jquery), expecting JSON result with embedded HTML in an array. If there is comment in HTML, jQuery produces unexpected behaviour (strip some unnecessary tags like tr`s, td`s which is really really ugly). Solution is to remove comments from HTML that you plan to deliver this way.
The optimistic programmer thinks the hidden traps are found, but IE6 produces 'unknown error on line 11' with code
$('#id_of_tbody').html(ajax_response);
After some desperation found out that according to msdn some elements are read-only for IE, among them tbody (nice DYNAMIC Object Model), so .innerHTML is not usable, my guess is that jQuery`s .html() function uses it in background.
The solution is
$('#id_of_tbody').empty().append(ajax_response);
What a nice day to be a programmer :) My mother told me I should be a fisherman, but they have to wake up early (and protest on the streets against high prices of fuel)...
Wednesday, June 4, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment