[whatwg] HTML Audio Element removal from DOM
Andrew Scherkus
scherkus at google.com
Tue Jan 17 13:49:35 PST 2012
On Tue, Jan 17, 2012 at 1:38 PM, Eric Carlson <eric.carlson at apple.com>wrote:
>
> On Jan 17, 2012, at 1:32 PM, Andrew Scherkus wrote:
>
> > On Tue, Jan 17, 2012 at 1:19 PM, Charles Pritchard <chuck at jumis.com>
> wrote:
> >
> >> When an <audio> element is removed from the DOM while playing, is that
> >> element paused?
> >> That seems to be the behavior in Chrome. I'm looking for clarification.
> >
> >
> > I was able to repro this in both Safari 5.1.1 and Chrome 17.0.963.26 dev
> so
> > perhaps it's a bug in WebKit as the spec states the following:
> > """
> > Media elements that are potentially playing while not in a Document must
> > not play any video, but should play any audio component. Media elements
> > must not stop playing just because all references to them have been
> > removed; only once a media element is in a state where no further audio
> > could ever be played by that element may the element be garbage
> collected.
> > """
> >
>
> That is for an element that is playing when it is not in the document.
> Look at the end of
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#playing-the-media-resourcefor the definition of what to do when an element is removed from the DOM:
>
> When a media element is removed from a Document, the user agent must run
> the following steps:
> 1. Asynchronously await a stable state, allowing the task that
> removed the media element from the
> Document to continue. The synchronous section consists of
> all the remaining steps of this algorithm.
> (Steps in the synchronous section are marked with.)
> 2. If the media element is in a Document, abort these steps.
> 3. If the media element's networkState attribute has the value
> NETWORK_EMPTY, abort these steps.
> 4. Pause the media element.
Ah yes! I got the scenarios mixed up.
The section I quoted is for programatically creating elements outside of
the DOM (i.e., new Audio()).
Andrew
More information about the whatwg
mailing list