I assume that you want to keep the same content, even if the NodeList set has changed.
If this is the case, the bad news is: IE8 is broken. And it cannot handle the use of a slice in a NodeList.
Thus, you will need to use the backup and do a βsliceβ yourself if the fragment fails (using try / catch).
Please note: if you do not expect the DOM to change, and if the array-like object is sufficient, you can simply use the NodeList like any other array (except that it is not, and perhaps it will change if the DOM changes).
[edit] This is actually not a broken design, it is allowed by the standard (as indicated by the link in the comment by Kelvin Mackay)
MaΓ«l nison
source share