else if (elem.getNodeType() == elem.TEXT_NODE) {
else if (elem.getNodeType() == Node.TEXT_NODE) {
    public Layout getLayout(Context c, Node elem) {        //u.p("getting layout for node: " + elem);        // we have to do the inputs manually since they don't depend on        // the element name        if (elem.getNodeType() == elem.ELEMENT_NODE) {            if (elem.getNodeName().equals("input")) {                Element el = (Element) elem;                String type = el.getAttribute("type");                if (type == null) {                    return new InputButton();                }                if (type.equals("button")) {                    return new InputButton();                }                if (type.equals("checkbox")) {                    return new InputCheckbox();                }                //if(type.equals("file")) { return new InputCheckbox(); }                if (type.equals("hidden")) {                    return new NullLayout();                }                if (type.equals("image")) {                    return new InputImage();                }                if (type.equals("password")) {                    return new InputPassword();                }                if (type.equals("radio")) {                    return new InputRadio();                }                if (type.equals("reset")) {                    return new InputButton();                }                if (type.equals("submit")) {                    return new InputButton();                }                if (type.equals("text")) {                    return new InputText();                }            }            // check for floats            CalculatedStyle style = c.css.getStyle(elem);            if (LayoutUtil.isFloated(style)) {                //u.p("in layout factory, found a floated element. forcing display: block");                return getCustomLayout("block");            }            // do normal layout resolution next            Layout lyt = getCustomLayout(c, (Element) elem);            if (lyt != null) {                return lyt;            }        }        // skip whitespace only nodes        else if (elem.getNodeType() == elem.TEXT_NODE) {            if (elem.getNodeValue().trim().equals("")) {                return new NullLayout();            }            //}            //if (elem.getNodeType() == elem.TEXT_NODE) {            return new AnonymousBoxLayout();        } else /*if (elem.getNodeType() == elem.COMMENT_NODE) */ {            return new NullLayout();        }        /*u.p("yo! got here w/ " + elem);        XRLog.layout(Level.WARNING, "error! returning null! type = " + elem.getNodeType());        XRLog.layout(Level.INFO, "error! returning null! type = " + elem.getNodeType());        XRLog.layout(Level.INFO, "name = " + elem.getNodeName());        XRLog.layout(Level.INFO, "node = " + elem);        XRLog.layout(Level.INFO, "attribute = " + elem.ATTRIBUTE_NODE);        XRLog.layout(Level.INFO, "cdata = " + elem.CDATA_SECTION_NODE);        XRLog.layout(Level.INFO, "coomment = " + elem.COMMENT_NODE);        XRLog.layout(Level.INFO, "frag = " + elem.DOCUMENT_FRAGMENT_NODE);        XRLog.layout(Level.INFO, "document = " + elem.DOCUMENT_NODE);        XRLog.layout(Level.INFO, "doctype = " + elem.DOCUMENT_TYPE_NODE);        XRLog.layout(Level.INFO, "element = " + elem.ELEMENT_NODE);        XRLog.layout(Level.INFO, "entity = " + elem.ENTITY_NODE);        XRLog.layout(Level.INFO, "entity ref = " + elem.ENTITY_REFERENCE_NODE);        XRLog.layout(Level.INFO, "notation = " + elem.NOTATION_NODE);        XRLog.layout(Level.INFO, "processing inst = " + elem.PROCESSING_INSTRUCTION_NODE);        XRLog.layout(Level.INFO, "text node = " + elem.TEXT_NODE);        return new InlineLayout();//inline is the CSS default, I guess we should never get here? */        throw new RuntimeException("Bad node into getLayout");//fail fast, crash hard    }