dojo/dojo — pull request #79 by wkeese (2014-04-21 01:34:45+00:00)
Title: Refactor empty() to work better on non-IE browsers.

1. Check node.innerHTML rather thatn node.canHaveChildren(), since the latter
only works on IE.
2. Also, limit empty(parent) to orphaning parent's children, rather than orphaning
parent's grandchildren.

Fixes https://bugs.dojotoolkit.org/ticket/17869.

IIRC there was a lot of debate about whether a scorched-earth `destroy()` method did more harm than good on IE, and by corollary debate about how `empty()` should work. But `empty()` is somewhat a different ball of wax from `destroy()`: while `destroy()` is arguably supposed to work recursively, `empty(parent)` arguably shouldn't orphan the parent's grandchildren.