Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorphilips
    • CommentTimeNov 7th 2006
     
    Let's say I have a document with the following structure:

    [code]
    <html>
    <head><title>Blah</title></head>

    <body>

    <div>This chicken tastes <span style="font-weight: bold;">really</span> good.</div>

    </body>
    </html>
    [code]
    What is the div's text node? Is it 'This chicken tastes good?' Are there two text nodes because of the span ('This chicken tastes,' 'good')?
    • CommentAuthorashmi
    • CommentTimeNov 7th 2006
     
    The DIV element has 3 childNodes.


    <#text/><SPAN/><#text/>


    <html>
    <head><title>Test 2</title>
    <script type="text/javascript">
    window.onload = function(){
       var div = document.getElementById('root');
       var d = '';
       for(var i=0; i<div.childNodes.length; i++){
          d += '<' + div.childNodes[i].nodeName + '>';
       }
       alert(d);
    }
    </script>
    </head>
    <body>
    <div id="root">This chicken tastes <span style="font-weight: bold;">really</span> good.</div>
    </body>
    </html>