diff --git a/impl/src/main/java/com/sun/faces/renderkit/html_basic/BodyRenderer.java b/impl/src/main/java/com/sun/faces/renderkit/html_basic/BodyRenderer.java index 86867dc427..29be9470f2 100644 --- a/impl/src/main/java/com/sun/faces/renderkit/html_basic/BodyRenderer.java +++ b/impl/src/main/java/com/sun/faces/renderkit/html_basic/BodyRenderer.java @@ -54,7 +54,9 @@ public void decode(FacesContext context, UIComponent component) { public void encodeBegin(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("body", component); - writeIdAttributeIfNecessary(context, writer, component); + if (RenderKitUtils.isOutputHtml5Doctype(context)) { + writeIdAttributeIfNecessary(context, writer, component); + } String styleClass = (String) component.getAttributes().get("styleClass"); if (styleClass != null && styleClass.length() != 0) { writer.writeAttribute("class", styleClass, "styleClass"); diff --git a/impl/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java b/impl/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java index d549d377f9..620aa439fc 100644 --- a/impl/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java +++ b/impl/src/main/java/com/sun/faces/renderkit/html_basic/HeadRenderer.java @@ -26,7 +26,6 @@ import jakarta.faces.component.UIViewRoot; import jakarta.faces.context.FacesContext; import jakarta.faces.context.ResponseWriter; -import jakarta.faces.render.Renderer; /** * /** @@ -35,7 +34,7 @@ * resources that should be output before the head tag is closed. *

*/ -public class HeadRenderer extends Renderer { +public class HeadRenderer extends HtmlBasicRenderer { private static final Attribute[] HEAD_ATTRIBUTES = AttributeManager.getAttributes(AttributeManager.Key.OUTPUTHEAD); @@ -48,12 +47,10 @@ public void decode(FacesContext context, UIComponent component) { public void encodeBegin(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); writer.startElement("head", component); - RenderKitUtils.renderPassThruAttributes(context, writer, component, HEAD_ATTRIBUTES); - if (RenderKitUtils.isOutputHtml5Doctype(context)) { - String clientId = component.getClientId(context); - writer.writeAttribute("id", clientId, "clientId"); + writeIdAttributeIfNecessary(context, writer, component); } + RenderKitUtils.renderPassThruAttributes(context, writer, component, HEAD_ATTRIBUTES); } @Override @@ -68,6 +65,16 @@ public void encodeEnd(FacesContext context, UIComponent component) throws IOExce writer.endElement("head"); } + /** + * Do we render our children. + * + * @return false. + */ + @Override + public boolean getRendersChildren() { + return false; + } + // --------------------------------------------------------- Private Methods private void encodeHeadResources(FacesContext context) throws IOException { diff --git a/impl/src/main/resources/com/sun/faces/metadata/taglib/faces.html.taglib.xml b/impl/src/main/resources/com/sun/faces/metadata/taglib/faces.html.taglib.xml index 89df08bf54..ef432df7df 100644 --- a/impl/src/main/resources/com/sun/faces/metadata/taglib/faces.html.taglib.xml +++ b/impl/src/main/resources/com/sun/faces/metadata/taglib/faces.html.taglib.xml @@ -1188,6 +1188,20 @@ jakarta.faces.Output jakarta.faces.Head + + + + The component identifier for this component. + This value must be unique within the closest parent component that is a naming container. + The attribute is only rendered when the current doctype is a HTML5 doctype. + + ]]> + + id + false + java.lang.String + jakarta.faces.Output jakarta.faces.Body + + + + The component identifier for this component. + This value must be unique within the closest parent component that is a naming container. + The attribute is only rendered when the current doctype is a HTML5 doctype. + + ]]> + + id + false + java.lang.String +