Gecko 1.9.1以前用のハック

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5671 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-12-26 08:00:12 +00:00
parent 2486925667
commit 5aac532c80

View File

@ -1319,10 +1319,23 @@ catch(e) {
fireTabSubtreeClosingEvent : function TSTService_fireTabSubtreeClosingEvent(aParentTab, aClosedTabs) fireTabSubtreeClosingEvent : function TSTService_fireTabSubtreeClosingEvent(aParentTab, aClosedTabs)
{ {
/* PUBLIC API */ /* PUBLIC API */
var event = aParentTab.ownerDocument.createEvent('UIEvents'); var event = aParentTab.ownerDocument.createEvent('Events');
event.initUIEvent('TreeStyleTabSubtreeClosing', true, true, aParentTab.ownerDocument.defaultView, aClosedTabs.length); event.initEvent('TreeStyleTabSubtreeClosing', true, true);
event.parent = aParentTab; event.parent = aParentTab;
event.tabs = aClosedTabs; event.tabs = aClosedTabs;
if (!event.getPreventDefault) {
// getPreventDefault is available on any event on Gecko 1.9.2 or later.
// on Gecko 1.9.1 or before, UIEvents only have the method...
event.__original__preventDefault = event.preventDefault;
event.__canceled = false;
event.preventDefault = function() {
this.__original__preventDefault();
this.__canceled = true;
};
event.getPreventDefault = function() {
return this.__canceled;
};
}
this.getTabBrowserFromChild(aParentTab).dispatchEvent(event); this.getTabBrowserFromChild(aParentTab).dispatchEvent(event);
return !event.getPreventDefault(); return !event.getPreventDefault();
}, },