public static boolean isOutputHtml5Doctype(FacesContext context) {
        UIViewRoot viewRoot = context.getViewRoot();
        if (viewRoot == null) {
            return false;
        }

        Doctype doctype = viewRoot.getDoctype();
        if (doctype == null) {
            return false;
        }

        String rootElement = doctype.getRootElement();
        String publicVal = doctype.getPublic();
        String system = doctype.getSystem();

        return "html".equalsIgnoreCase(rootElement)
                && publicVal == null
                && system == null;
    }
Returns <code>true</code> if the view root associated with the given {@link FacesContext}
will be rendered with a HTML5 doctype.

@param context Involved faces context.
@return <code>true</code> if the view root associated with the given faces context
     will be rendered with a HTML5 doctype.
primefaces/src/main/java/org/primefaces/renderkit/RendererUtils.java