How can I avoid javascript being included in selection in HTML selections

Suppose I select the following div but don't want the children script to be included. How can I exclude them?

<div>
<table>
...
</table>

<script>
....
</script>

<div>

And no, I can't target <table> because then the <table> tags themselves won't been included in the selection.