Closed Bug 302437 Opened 19 years ago Closed 17 years ago

Events not firing from within <browser/> XUL element

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: tennessee, Unassigned)

References

(Depends on 1 open bug, )

Details

(Keywords: testcase)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050727 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050727 Firefox/1.0+

Events are not firing correctly. Something weird going on with the browser element.

Reproducible: Always

Steps to Reproduce:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window 
        title="Bureau of Meteorology Data Viewer"
        orient="vertical"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml"
        align="start"
        id="main_window"
>
                                        
                                        
        <vbox id="testing-box">
                <button label="OK"/>
                <checkbox label="Show images"/>
        </vbox>
        
        <vbox style="overflow: auto;" flex="1">
                <browser src="http://www.google.com/" flex="1" id="data-browser"
height="200" width="500"/>
        </vbox>
        
        <script type="text/javascript;e4x=1">
                var mainWindow = document.getElementById("main_window");
                mainWindow.addEventListener("load", doKungFu(), false);
        
                function handleClicks(event) {
                        alert(event.target.tagName);     
                }
                
                function doKungFu() {
                        var testBox = document.getElementById("testing-box");
                        var dataBrowser = document.getElementById("data-browser");
                
                        testBox.addEventListener("click", handleClicks, false);
                        dataBrowser.addEventListener("click", handleClicks, false);
                }
        </script>
        
</window>
Actual Results:  
Nothing happens when you click something in the embedded browser

Expected Results:  
An alert dialog, giving the type of the event target.
Summary: Events not firing from withing <browser/> XUL element → Events not firing from within <browser/> XUL element
wfm Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b4) Gecko/20050727 SeaMonkey/1.0a
I can see the bug, this is rather similar to bug 185919, only in this case for
click events.
If you're loading this as a remote page then this is invalid as described.
If you're loading this as an extension window then this is worksforme.
(In reply to comment #0)
>var mainWindow = document.getElementById("main_window");
>mainWindow.addEventListener("load", doKungFu(), false);
Note: when testing, I corrected this incorrect code. I assume you meant one of:
document.addEventListener("load", doKungFu, false);
window.addEventListener("load", doKungFu, false);
<window onload="doKungFu();">

>var testBox = document.getElementById("testing-box");
>var dataBrowser = document.getElementById("data-browser");
>
>testBox.addEventListener("click", handleClicks, false);
>dataBrowser.addEventListener("click", handleClicks, false);
Note: when testing, I optimized this to <... onclick="handleClicks(event);">
Invalid per comment 3 and comment 4.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.