Bug 271629 - <video> elements moved out of a <template> immediately fail to load all candidate resources
Summary: <video> elements moved out of a <template> immediately fail to load all candi...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2024-03-24 23:59 PDT by Jonathan Heathcote
Modified: 2024-04-01 00:00 PDT (History)
4 users (show)

See Also:


Attachments
A demo HTML page with a button which, when clicked, moves a <video> element out of a <template> and onto the page.. (791 bytes, text/html)
2024-03-25 06:59 PDT, Jonathan Heathcote
no flags Details
A version of the demo file without the accidentally included workaround. Please use this file to reproduce the bug! (686 bytes, text/html)
2024-03-25 07:04 PDT, Jonathan Heathcote
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Heathcote 2024-03-24 23:59:20 PDT
Created attachment 470586 [details]
A demo HTML page with a button which, when clicked, moves a <video> element out of a <template> and onto the page..

# Environment

Epiphany 45.3, Arch Linux.


# Steps to reproduce:

When a <video> element is moved out of a <template> element (e.g. using .append(...)), the video will fail to play.

A demo HTML page is attached which does exactly the above when a button is clicked.


# Actual results:

When the 'Move video out of template' button is clicked, the video element is moved into the document but no video plays.


# Expected results:

The video should have loaded and played as usual.

NB: If the sample video element is placed on the page (i.e. outside the <template>) it plays correctly -- this is not a video format support issue.

A similar issue appears to be present in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1887573

The issue does not occur in Chromium.


# Workaround

For others impacted, the following workaround may be used immediately after inserting the element into the document to restore function:

```
const innerHTML = video.innerHTML;
video.innerHTML = "";
video.innerHTML = innerHTML;
```
Comment 1 Jonathan Heathcote 2024-03-25 00:02:23 PDT
My apologies, I accidentally uploaded a version of the demo.html file which included the workaround noted in the report.

Please remove lines 19-22 to see the effect of the bug!
Comment 2 Jonathan Heathcote 2024-03-25 00:04:03 PDT
Created attachment 470587 [details]
A version of the demo file without the accidentally included workaround. Please use this file to reproduce the bug!

Uploaded version of demo page without workaround.
Comment 3 Radar WebKit Bug Importer 2024-04-01 00:00:12 PDT
<rdar://problem/125704346>