Blank template result doesn't replace old result when re-rendering view

When a view is rendered, spits out markup, is rendered again with an empty result, the old markup does not get destroyed. This seems to be due to "if (rendered)" failing on an empty string in applyTemplate().

Writing a fix and a test for the bug.