Added karma tests
Fixed call to createHTMLDocument for Firefox 19