Open
Bug 357311
Opened 18 years ago
Updated 2 months ago
window.open(URL) does not work when it is invoke via middle mouse button click
Categories
(Core :: XUL, defect)
Tracking
()
UNCONFIRMED
People
(Reporter: tsaost, Unassigned)
Details
Attachments
(1 file, 1 obsolete file)
2.64 KB,
application/vnd.mozilla.xul+xml
|
Details |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7 If I am using a XUL <tree> and I tried to call window.open() then it will fail when it is called via <tree onclick="handleTreeMouseClick(event)"> when the click event is generated via the middle mouse button. The same code works fine when the click is generated by the left mouse button. Here is the sample XUL that shows the problem: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin" type="text/css"?> <?xml-stylesheet href="treebuddylist.css" type="text/css"?> <window title="Web Sites" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree hidecolumnpicker="true" flex="1" onclick="handleTreeMouseClick(event)"> <treecols> <treecol label="Web Sites" flex="1" primary="true"/> </treecols> <treechildren> <treeitem container="true" open="true"> <treerow> <treecell label="Search Engines"/> </treerow> <treechildren> <treeitem><treerow><treecell label="Google" url="http://www.google.com"/> </treerow></treeitem> <treeitem><treerow><treecell label="Yahoo" url="http://search.yahoo.com"/> </treerow></treeitem> </treechildren> </treeitem> <treeitem container="true" open="true"> <treerow> <treecell label="Shopping"/> </treerow> <treechildren> <treeitem><treerow><treecell label="Amazon" url="http://www.amazon.com"/> </treerow></treeitem> </treechildren> </treeitem> </treechildren> </tree> <script> <![CDATA[ if (console && console.debug) { debug = console.debug; } else { debug = function(x) { /* do nothing */ } } function getCellForMouseEvent(event, row, column) { var tree; tree = event.target; while (tree && !tree.view) { tree = tree.parentNode; } if (tree) { tree.boxObject.getCellAt(event.clientX, event.clientY, row, column, {}); if (0 <= row.value) { return tree; } } return null; } function handleTreeMouseClick(event) { var row = {}; const button = event.button; const column = {}; const tree = getCellForMouseEvent(event, row, column); if (!tree) { return; } row = row.value; debug("treewebsite.xul row: " + row); if (button != 2) { const treeitem = tree.view.getItemAtIndex(row); const cell = treeitem.childNodes[0].childNodes[0]; const url = cell.getAttribute("url"); debug("treewebsite.xul item url: " + url); if (event.detail == 2) { // double click on file if (!window.open(url)) { alert("Double click: can not open URL: " + url); } } else if (button == 1) { if (!window.open(url)) { alert("Middle button click: can not open URL: " + url); } } else { if (!window.open(url)) { alert("Single click: can not open URL: " + url); } } } } ]]> </script> </window> Reproducible: Always Steps to Reproduce: 1. Load up the sample XUL. 2. click on the tree items via the either the left mouse button or the middle mouse button. Actual Results: The new window pops up when invoke via the left mouse button that fails when it is invoked via the middle mouse button Expected Results: Single the middle mouse button is used to popup new tabs, it would be nice if the call to window.open(url) would open up a new tab or a new window.
Reporter | ||
Comment 1•18 years ago
|
||
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets
Updated•2 years ago
|
Severity: normal → S3
Comment hidden (spam) |
Updated•2 months ago
|
Attachment #9383800 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•