// viewRoot, so when this one is relocated, its parent will be this UIViewRoot instance
// and prevent a duplicate id exception.
UniqueIdVendor uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
// UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
// and call createUniqueId()
String uid = uniqueIdVendor.createUniqueId(ctx.getFacesContext(),null);
outputScript.setId(uid);
parent.getChildren().add(outputScript);
if (FaceletCompositionContext.getCurrentInstance(ctx).isMarkInitialState())