This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 12664 - Warn about the perils of registering event handlers after <video>
Summary: Warn about the perils of registering event handlers after <video>
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: LC1 HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 08:57 UTC by contributor
Modified: 2011-08-15 09:54 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2011-05-17 08:57:47 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html
Section: http://www.whatwg.org/specs/web-apps/current-work/#the-video-element

Comment:
Warn about the perils of registering event handlers after <video>

Posted from: 83.218.67.122
User agent: Opera/9.80 (X11; Linux x86_64; U; Opera Next; en) Presto/2.8.131 Version/11.50
Comment 1 Philip Jägenstedt 2011-05-17 08:59:45 UTC
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/031608.html
https://github.com/remy/html5demos/issues/12

The spec should advice authors about the safe methods of attaching event handlers on at least <audio>, <video> and <img>.

(Given that such advice will be ignored, I would prefer a proper fix, but I have no concrete such fix to suggest.)
Comment 2 Ian 'Hixie' Hickson 2011-06-02 23:04:41 UTC
What exactly do you think the spec should say, and where?
Comment 3 Philip Jägenstedt 2011-06-30 15:52:18 UTC
In the "Best practices for authors using media elements" section, there should be a short example with a <video> tag followed directly by a <script> tag adding event handlers. It should be explained why the code is racy and other ways of doing it correctly should be suggested.

Do you need more detail, or can you make something up?
Comment 4 Michael[tm] Smith 2011-08-04 05:04:48 UTC
mass-moved component to LC1
Comment 5 Ian 'Hixie' Hickson 2011-08-11 21:39:48 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: I didn't put it in the video section because it's a general problem, and I didn't use <video> to illustrate it because it's more complicated than necessary to show the problem. But I added a section that shows how to write good code here to avoid this mistake.
Comment 6 contributor 2011-08-11 21:43:04 UTC
Checked in as WHATWG revision r6421.
Check-in comment: An intro section on avoiding common pitfalls with scripts. File bugs if you have ideas of other things to mention here.
http://html5.org/tools/web-apps-tracker?from=6420&to=6421
Comment 7 Philip Jägenstedt 2011-08-15 09:54:52 UTC
Thanks, I guess that's about as much as we can do.