sorttable bug: xml-xhtml

From a user:

I’ve tried to run your script in XHTML (the real one, in XML mode) and ran
into some minor compatibility issues—in XHTML <tbody> isn’t created
automatically and use of innerHTML is forbidden.

The fixes:
in makeSortable add:

if (table.tBodies.length === 0)
{
var tBody = document.createElement(‘tbody’);
table.appendChild(tBody);
var trs=[];
for(var i=0;i<table.childNodes;i++)
{
if (table.childNodes[i].tagName.toLowerCase()===‘tr’)
{
trs[trs.length] = table.childNodes[i];
}
}
for(var i=0;i<trs.length;i++)
{
tBody.appendChild(trs[i]);
}
}

and replace innerHTML with code like:

if (stIsIE) sortfwdind.innerHTML = ’&nbsp<font
face=“webdings”>6</font>’; else
sortfwdind.appendChild(document.createTextNode(”\u00A0\u25BE”));

Back to the sorttable bug list

Email me when this bug gets updated: · privacy · powered by ChangeDetection