Skip to content

Commit 179c942

Browse files
committed
fix(core): make timing masks safe for source loaders
1 parent 45dfcd5 commit 179c942

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/core/src/compiler/timingCompiler.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ describe("compileTimingAttrs", () => {
168168
expect(compiled).toContain('id="hf-video-0"');
169169
expect(compiled).toContain('data-end="2"');
170170
});
171+
172+
it("preserves inert regions when compiled output is compiled again", () => {
173+
const html = [
174+
'<style>.hero::after { content: "$& $$ $` $\' <video>"; }</style>',
175+
'<script>const markup = "$& $$ $` $\' <audio>";</script>',
176+
'<video class="hero" src="a.mp4" data-start="0" data-duration="2">',
177+
].join("\n");
178+
179+
const first = compileTimingAttrs(html).html;
180+
const second = compileTimingAttrs(first).html;
181+
182+
expect(second).toContain('<style>.hero::after { content: "$& $$ $` $\' <video>"; }</style>');
183+
expect(second).toContain('<script>const markup = "$& $$ $` $\' <audio>";</script>');
184+
expect(second).toContain('data-end="2"');
185+
expect(second).not.toContain("HFMASK");
186+
});
171187
});
172188

173189
describe("injectDurations", () => {

0 commit comments

Comments
 (0)