I've found a bug while using replaceHTML kss command.<br>The deal here is to create a DIV element to let the browser engine to parse HTML code. The problem is that in gecko browser (maybe others too) when adding a node requiring a special parent node (LI, TR, TD, DT, DD etc...) it will skip those nodes because the DIV element does not fit in this case.<br>
<br>Here's my dirty quick patch:<br><br clear="all">var restrictedParentNodes = {<br> 'th': 'thead',<br> 'td': 'tr',<br> 'tr': 'table',<br> 'thead': 'table',<br>
'tbody': 'table',<br> 'tfoot': 'table',<br> 'li': 'ul',<br> 'dt': 'dl',<br> 'dd': 'dl',<br> 'option': 'select',<br>
'optgroup': 'select',<br>};<br>kukit.dom.parseHTMLNodes = function(txt){<br> var firstNode = /<([^> ]*)[> ]/.exec(txt);<br> firstNode = firstNode ? firstNode[1] : null;<br> var node = document.createElement(restrictedParentNodes[firstNode] || 'div');<br>
node.innerHTML = txt;<br> console.log(node.firstChild);<br> // gecko engine automatically adds a TBODY node<br> if (node.firstChild) {<br> if (node.firstChild.nodeType == 3)<br> node.removeChild(node.firstChild);<br>
if (node.firstChild.nodeName == 'TBODY')<br> node = node.firstChild;<br> }<br> var resultNodes = [];<br> for (var i=0; i<node.childNodes.length; i++) {<br> resultNodes.push(node.childNodes.item(i));<br>
}<br> return resultNodes;<br>};<br>-- <br>Christophe BOSSE - Développeur<br>INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632<br>Bureaux de la Colline - 1 rue Royal - Bâtiment D - 9ème étage<br>92210 Saint Cloud - France<br>
Phone : 01 78 15 24 02 / Fax : 01 46 02 44 04<br><a href="http://www.ingeniweb.com">http://www.ingeniweb.com</a> - une société du groupe Alter Way