repetitive appendChild of a <video> to the same element stops the video

RESOLVED INVALID

Status

()

Core
Audio/Video
RESOLVED INVALID
3 years ago
3 years ago

People

(Reporter: yury, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
Created attachment 8534964 [details]
Minimal test case to reproduce the issue

I found difference between Firefox and Chrome behavior while fixing the bug 1108796. Looks like Chrome does not perform anything in appendChild if the child element is already in its place in the DOM; e.g. div.appendChild(video); will not stop the video if it is already appended to the div. For comparison, the video stops in Firefox.

Updated

3 years ago
Component: DOM: Core & HTML → Video/Audio
Per spec, div.appendChild(video) must have exactly the same observable behavior as doing these steps:

  video.remove();
  div.appendChild(video);

Is that not the case in Chrome?
Flags: needinfo?(ydelendik)
(Reporter)

Comment 2

3 years ago
(In reply to Boris Zbarsky (Vacation Dec 15-31) [:bz] from comment #1)
> 
> Is that not the case in Chrome?

It is not. It looks like Chromium is doing if-already-last-child-of optimization [1]. You are right -- the spec does not define this type of optimization. won't fix?


  [1] https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/dom/ContainerNode.cpp&rcl=1418267803&l=693

Comment 3

3 years ago
That blink behavior is totally nuts. Please file a chromium bug.
I filed https://code.google.com/p/chromium/issues/detail?id=441355
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Flags: needinfo?(ydelendik)
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.