private HeadElement getHead() { if (head == null) { Element elt = Document.get().getElementsByTagName("head").getItem(0); assert elt != null : "The host HTML page does not have a <head> element" + " which is required by StyleInjector"; head = HeadElement.as(elt); } return head; }
public StyleElement injectStyleSheetAtStart(String contents) { StyleElement style = createElement(contents); getHead().insertBefore(style, head.getFirstChild()); return style; }