Removing elements from an object with changing indexes
<p>I am having trouble deleting rules from the stylesheet object due to ever changing indexes.</p>

<p>I have this function:</p>

<pre><code>function delete_styles(delete_array){

    console.log(delete_array); // ["0,0", "0,1", "0,2", "0,6", "0,7", "0,8", "0,9", "0,10", "0,14", "0,15", "0,16"]

    for(var i in delete_array){

        var pair = delete_array[i].split(',');
        var p1 = parseInt(pair[0]);
        var p2 = parseInt(pair[1]);

        document.styleSheets[p1].deleteRule(p2);

    }
}
</code></pre>

<p>However, as soon as I delete <code>(0,0)</code>, the index <code>(0,1)</code> is invalid because it becomes <code>(0,0)</code>!</p>

<p>I can't just use a counter and take a way an incrementing amount each time because there may be larger gaps in the CSS rules.</p>

<p>Any help on the logic here?</p>
