public void setCaption( FieldSetElement fieldset, Element legend, @IsSafeHtml String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }
public void setCaption(FieldSetElement fieldset, Element legend, String caption, boolean asHTML) { // TODO(bruce): rewrite to be inlinable assert (caption != null); if (asHTML) { legend.setInnerHTML(caption); } else { legend.setInnerText(caption); } if (!"".equals(caption)) { // This is formulated to become an append (if there's no widget), an // insertion at index 0 (if there is a widget but no legend already), or // a no-op (if the legend is already in place). fieldset.insertBefore(legend, fieldset.getFirstChild()); } else if (legend.getParentNode() != null) { // We remove the legend from the DOM because leaving it in with an empty // string renders as an ugly gap in the top border on some browsers. fieldset.removeChild(legend); } } }