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 23956 - what if there's no browsing context when you "get the current value of the event handler"?
Summary: what if there's no browsing context when you "get the current value of the ev...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-02 19:28 UTC by contributor
Modified: 2014-01-06 22:10 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2013-12-02 19:28:04 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#getting-the-current-value-of-the-event-handler
Complete: http://www.whatwg.org/c#getting-the-current-value-of-the-event-handler
Referrer: 

Comment:
what if there's no browsing context when you "get the current value of the
event handler"?

Posted from: 2620:0:1000:167c:84ad:7d24:e50b:d745 by ian@hixie.ch
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1712.4 Safari/537.36
Comment 1 Ian 'Hixie' Hickson 2013-12-02 21:53:54 UTC
Set attribute, import node, click:
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2672
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2675
Set attribute, click, import node, click:
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2673
  http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2674

If I'm interpreting this right:
Firefox acts as if it compiled the script in the context of the original document.
Chrome fails to compile the script if it's not in a document with a global object.
Comment 2 Boris Zbarsky 2013-12-02 22:11:04 UTC
Yeah, the Firefox behavior here is rather wacky.  I don't think we object to changing it.

If we do want to always compile the script, using the global that would be used for the JS reflection of the node's ownerDocument would make sense to me.

Olli, thoughts?
Comment 3 Olli Pettay 2013-12-02 22:13:41 UTC
Yeah, I was planning to change Gecko's behavior even before this bug.
(because of https://bugzilla.mozilla.org/show_bug.cgi?id=944847)
Comment 4 Ian 'Hixie' Hickson 2013-12-05 19:01:50 UTC
Ok so if the event handler is on an Element and the Element's Document has no browsing context, we should just set it to null when we're compiling?
Comment 5 Olli Pettay 2013-12-05 19:36:25 UTC
...and keep the uncompiled handler so that if the element is adopted to a document which is in a browsing context the element gets the handler compiled.
Comment 6 Ian 'Hixie' Hickson 2013-12-12 22:37:37 UTC
Wow, you're not kidding. Thanks for pointing that out, I would never have thought to even check for that.

  http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2692
  http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2693
Comment 7 contributor 2014-01-06 21:35:31 UTC
Checked in as WHATWG revision r8375.
Check-in comment: Rearrange requirements for handling internal raw uncompiled handlers
http://html5.org/tools/web-apps-tracker?from=8374&to=8375
Comment 8 Ian 'Hixie' Hickson 2014-01-06 22:10:33 UTC
  http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2711
  http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2714
  http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2718

Ok I think the spec now matches what Firefox does on these tests. (Chrome is a little different, e.g. in 2718.)
Comment 9 contributor 2014-01-06 22:10:44 UTC
Checked in as WHATWG revision r8376.
Check-in comment: Make content attribute event handlers work slightly more like in more browsers.
http://html5.org/tools/web-apps-tracker?from=8375&to=8376