Fix #405 - compatibility with html5lib 1.0

Tests now pass under 2.7.