private static HeadElement getHead() { if (head == null) { Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; HeadElement headElement = HeadElement.as(element); head = headElement; } return head; }
/** * Gets the document header. * * @return the document header */ protected static HeadElement getHead() { if (head == null) { final Element element = Document.get().getElementsByTagName("head").getItem(0); assert element != null : "HTML Head element required"; final HeadElement head = HeadElement.as(element); AbstractInjector.head = head; } return AbstractInjector.head; }
public static void intject(String javaScript) { HeadElement head = getHead(); ScriptElement element = createScriptElement(); element.setText(javaScript); head.appendChild(element); }