patch `toHandle` and `toHandleWidth` to properly handle actuals that don't match to any elements

I noticed while upgrading my tests that these were giving nodeType errors, so here's my attempt at fixing. Let me know if I need to make any other changes to make it palatable for pulling. :)