>
> > I find one particular issue: maybe the first text node should not be
> > removed unconditionally.
>

Yes you're right I have just quickly suggested to correct it that way and
thare are bugs in what I have sent you.

> Yes, do note that some of these will (probably) never work in IE
> (replacing part of the table, options etc.).

What's is not supposed to work ?  Those nodes work like in other browsers
excepted it does not restrict contained nodes.

My last suggestion would be:
var restrictedContainerNodes = {
    'TD': 'TABLE',
    'TH': 'TABLE',
    'TR': 'TABLE',
    'THEAD': 'TABLE',
    'TBODY': 'TABLE',
    'TFOOT': 'TABLE',
    'LI': 'UL',
    'DT': 'DL',
    'DD': 'DL',
    'OPTION': 'SELECT',
    'OPTGROUP': 'SELECT',
};
kukit.dom.parseHTMLNodes = function(txt){
    var firstNode = /<([^> ]*)[> ]/.exec(txt);
    firstNode = firstNode ? firstNode[1].toUpperCase() : null;
    var node = document.createElement(restrictedContainerNodes[firstNode] ||
'DIV');
    node.innerHTML = txt;
    // gecko engine automatically adds a TBODY node for table elements
    if (node.firstChild) {
        var elementNode = node.firstChild.nodeType != 3 ? node.childNodes[0]
:

node.childNodes[1];
        if (restrictedContainerNodes[firstNode] == 'TABLE' &&
            restrictedContainerNodes[elementNode.nodeName] == 'TABLE')
            node = elementNode;
    }
    var resultNodes = [];
    for (var i=0; i<node.childNodes.length; i++) {
        resultNodes.push(node.childNodes.item(i));
    }
    return resultNodes;
};



-- 
Christophe BOSSE - Développeur
INGENIWEB (TM) - SAS 50000 Euros - RC B 438 725 632
Bureaux de la Colline - 1 rue Royal - Bâtiment D - 9ème étage
92210 Saint Cloud - France
Phone : 01 78 15 24 02 / Fax : 01 46 02 44 04
http://www.ingeniweb.com - une société du groupe Alter Way
_______________________________________________
Kss-devel mailing list
[email protected]
http://codespeak.net/mailman/listinfo/kss-devel

Reply via email to