Skip to content

Inconsistent cross-browser behavior for mutating child <source>s of a <video> #12500

@nicolo-ribaudo

Description

@nicolo-ribaudo

What is the issue with the HTML Standard?

I'm opening this issue here rather than in the browsers bug tracker because I'm not even sure about:

  • what the HTML spec says
  • what the intended behavior is

Consider a <video> element with two <source>s (source1 and source2) with a URL that returns an error. After that we try (and fail) loading both, consider these two (alternative) test cases:

  • A: we add a third valid <source> at the end
  • B: we set the .src of the first <source> to something valid, and then move (with .moveBefore()) it to the end of <video>
  • C: we set the .src of the first <source> to something valid, and then move (with .moveBefore()) the second <source> before the first one

What I'm seeing in browsers is:

A B C
Firefox loads loads does not load
Chrome does not load does not load does not load
WebKit does not load moveBefore not supported moveBefore not supported

Test case (AI-generated based on my description): index.html

I think the behavior that the spec describes is:

  • A: loads, because:
    • the new source is inserted between the two nodes that define the pointer (source2 and the original list end), so the pointer is updated to point between the second and the third source
    • the resource selection algorithm continues from step 22 of the "children" mode, and then jumps to step 13, 15, 16, 17, 2, 3, 4, 5, 6, 7, 8, 9.
  • B: loads, because:
    • the source1 is moved between the two nodes that define the pointer (source2 and the original list end), so the pointer is updated to point between source2 and source1
    • the resource selection algorithm continues from step 22 of the "children" mode, and then jumps to step 13, 15, 16, 17, 2, 3, 4, 5, 6, 7, 8, 9.
  • C: 🤷, I don't think the pointer is updated, but it's left in an invalid state because:
    • no node is inserted
    • the node that is moved (source2) is not moved between the ones that define the pointer (source2 and the list end)
    • no node is removed

I believe it's likely I'm interpreting the wording about inserting/removing/moving nodes inside the media element too literally (but I am doing it because it links to their definitions!), and C is intended to behave the same as B.

Probably the intended behavior is that all three test cases should load?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions