Question: I have this DOM tree:

```
<li> 
data ....
  <br>
  data ...
  <img ... />
  <br>
  <script> ... </script>
  <span> data ... </span>
</li>

```

how can I loop through the children of the above li element that fall between the li itself and script element, i.e. script and span elements are out of the loop ...
thanks in advace !!

note: I do not want to use JQuery, because my app is using Protoype and it will conflict with JQuery if I use both of them together, i'd appreciate it if there's a quick solution using Prototype.

Answer: 
would something like this work for you?

```
var child = liElement.firstChild;
while(child){
    if(child.nodeName.toLowerCase() == 'script'){
        break
    }
    //do your stuff here
    child = child.nextSibling;
}

```

Note, the if the "data" in your example are strings, these will exist in the child heirarchy as instances of textNodes. if you need to do special processing on this stuff, you will want to do a check such as

```
switch(child.nodeType){
case 3:
   //text Node
   break;
case 1:
   //Element node
   break;
default:
    //break;
}

```

check out 
<https://developer.mozilla.org/en/nodeType> for more node types
hav eyou taken a look at jquery ? it has a very nic query syntax. i`m nit sure what elements exactly you want to loop over but for intance: 
$('li > img') will return all images under all list items. check out the spec for more [jquery](http://api.jquery.com/category/selectors/)