Fix the slice check

As of 9751a47ded9693140af2aa635f7a9d928ac30a0b, `docElem` is not defined at the point of its use in the `slice` check, so it always fails, and the native `slice` never gets used.