< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java

Print this page

        

@@ -101,10 +101,21 @@
         attrs.put(nullCheck(attrName), Entity.escapeHtmlChars(attrValue));
         return this;
     }
 
     /**
+     * Sets the "id" attribute for this tag.
+     *
+     * @param id the value for the id attribute
+     * @return this object
+     */
+    public HtmlTree setId(String id) {
+        put(HtmlAttr.ID, id);
+        return this;
+    }
+
+    /**
      * Sets the "title" attribute for this tag.
      * Any HTML tags in the content will be removed.
      *
      * @param body the content for the title attribute
      * @return this object

@@ -266,39 +277,10 @@
         htmltree.put(HtmlAttr.HREF, encodeURL(ref));
         return htmltree;
     }
 
     /**
-     * Generates an HTML anchor tag with id attribute and a body.
-     *
-     * @param id id for the anchor tag
-     * @param body body for the anchor tag
-     * @return an HtmlTree object
-     */
-    public static HtmlTree A_ID(String id, Content body) {
-        HtmlTree htmltree = new HtmlTree(HtmlTag.A);
-        htmltree.put(HtmlAttr.ID, nullCheck(id));
-        htmltree.add(nullCheck(body));
-        return htmltree;
-    }
-
-    /**
-     * Generates an HTML anchor tag with a style class, id attribute and a body.
-     *
-     * @param styleClass stylesheet class for the tag
-     * @param id id for the anchor tag
-     * @param body body for the anchor tag
-     * @return an HtmlTree object
-     */
-    public static HtmlTree A_ID(HtmlStyle styleClass, String id, Content body) {
-        HtmlTree htmltree = A_ID(id, body);
-        if (styleClass != null)
-            htmltree.setStyle(styleClass);
-        return htmltree;
-    }
-
-    /**
      * Generates a CAPTION tag with some content.
      *
      * @param body content for the tag
      * @return an HtmlTree object for the CAPTION tag
      */

@@ -731,10 +713,23 @@
             htmltree.setStyle(styleClass);
         return htmltree;
     }
 
     /**
+     * Generates an SPAN tag with id attribute and a body.
+     *
+     * @param id id for the tag
+     * @param body body for the tag
+     * @return an HtmlTree object for the SPAN tag
+     */
+    public static HtmlTree SPAN_ID(String id, Content body) {
+        HtmlTree htmltree = new HtmlTree(HtmlTag.SPAN, nullCheck(body));
+        htmltree.put(HtmlAttr.ID, nullCheck(id));
+        return htmltree;
+    }
+
+    /**
      * Generates a SPAN tag with id and style class attributes. It also encloses
      * a content.
      *
      * @param id the id for the tag
      * @param styleClass stylesheet class for the tag

@@ -944,10 +939,12 @@
             case META :
                 return (hasAttr(HtmlAttr.CONTENT) && !hasContent());
             case SCRIPT :
                 return ((hasAttr(HtmlAttr.TYPE) && hasAttr(HtmlAttr.SRC) && !hasContent()) ||
                         (hasAttr(HtmlAttr.TYPE) && hasContent()));
+            case SPAN :
+                return (hasAttr(HtmlAttr.ID) || hasContent());
             default :
                 return hasContent();
         }
     }
 
< prev index next >