diff --git a/packages/producer/src/services/htmlCompiler.ts b/packages/producer/src/services/htmlCompiler.ts
index 533e04c7e..2203b764e 100644
--- a/packages/producer/src/services/htmlCompiler.ts
+++ b/packages/producer/src/services/htmlCompiler.ts
@@ -559,6 +559,19 @@ function inlineSubCompositions(
if (!hosts.length) return html;
+ const FLATTENED_INNER_ROOT_STRIP_ATTRS = [
+ "data-composition-id",
+ "data-composition-file",
+ "data-start",
+ "data-duration",
+ "data-end",
+ "data-track-index",
+ "data-track",
+ "data-composition-src",
+ "data-hf-authored-duration",
+ "data-hf-authored-end",
+ ];
+
const result = inlineSubCompositionsShared(
document as unknown as Document,
hosts as unknown as Element[],
@@ -574,6 +587,19 @@ function inlineSubCompositions(
return compHtml;
},
parseHtml: (htmlStr: string) => parseHTML(htmlStr).document as unknown as Document,
+ flattenInnerRoot: (innerRoot: Element): Element => {
+ const prepared = innerRoot.cloneNode(true) as Element;
+ const authoredRootId = prepared.getAttribute("id")?.trim();
+ for (const attrName of FLATTENED_INNER_ROOT_STRIP_ATTRS) {
+ prepared.removeAttribute(attrName);
+ }
+ if (authoredRootId) {
+ prepared.removeAttribute("id");
+ prepared.setAttribute("data-hf-authored-id", authoredRootId);
+ }
+ prepared.setAttribute("data-hf-inner-root", "true");
+ return prepared;
+ },
scriptErrorLabel: "[Compiler] Composition script failed",
},
);