Most appropriate sub-area of p5.js?
DOM
p5.js version
2.x main (4b096e2)
Actual vs expected behavior
The src setter on p5.MediaElement removes existing <source> children with a forward index loop over the live HTMLCollection, which skips every other child as the collection reindexes:
const v = createVideo(['a.mp4', 'b.webm']);
v.src = 'c.mp4';
v.elt.childElementCount; // actual 2 (leftover b.webm + c.mp4), expected 1
v.src; // actual ends with 'b.webm' (getter returns children[0].src), expected 'c.mp4'
So after assigning a new source, reading v.src reports the old one, and the media element still lists the stale source first. The same code exists in 1.x, so this is longstanding rather than a 2.x regression.
Steps to reproduce
Outputs above are from executed runs against current main via the DOM unit test harness (the two new tests fail on unfixed code with expected 2 to deeply equal 1 and expected false to be true).
Note
I have a fix ready (iterate the live collection backwards, with a comment) plus 2 regression tests in the createVideo suite; the DOM suite passes 14 with it. Filing for approval per the contributing guide; will open the PR once approved.
Most appropriate sub-area of p5.js?
DOM
p5.js version
2.x main (4b096e2)
Actual vs expected behavior
The
srcsetter onp5.MediaElementremoves existing<source>children with a forward index loop over the liveHTMLCollection, which skips every other child as the collection reindexes:So after assigning a new source, reading
v.srcreports the old one, and the media element still lists the stale source first. The same code exists in 1.x, so this is longstanding rather than a 2.x regression.Steps to reproduce
Outputs above are from executed runs against current main via the DOM unit test harness (the two new tests fail on unfixed code with
expected 2 to deeply equal 1andexpected false to be true).Note
I have a fix ready (iterate the live collection backwards, with a comment) plus 2 regression tests in the createVideo suite; the DOM suite passes 14 with it. Filing for approval per the contributing guide; will open the PR once approved.