Add tests for tag, attribute and class initialisation specifically. Write test for and fix bug where class names may contain newlines.