[Project_owners] Event.button in Firefox 1.5.0.2

Didier Ernotte didier at ernotte.com
Sat May 13 21:44:10 EDT 2006


Hi,

As it was said here, it is related to a known bug

https://bugzilla.mozilla.org/show_bug.cgi?id=297919

I have corrected it in a rush with this

    var leftButton = 0;
    if ((navigator.userAgent.indexOf("rv:1.8.0.2") == -1) &&
(navigator.userAgent.indexOf("rv:1.8.0.3") == -1))
    {
        leftButton = ((navigator.userAgent.indexOf("Firefox/1.0+") ==
-1) &&
                      (navigator.userAgent.indexOf("Firefox/1.4") ==
-1) &&
                      (navigator.userAgent.indexOf("Firefox/1.5") ==
-1) &&
                      (navigator.userAgent.indexOf("Thunderbird/1.5")
== -1) &&
                      (navigator.userAgent.indexOf("SeaMonkey") == -1)
&&
                      (navigator.userAgent.indexOf("rv:1.9") == -1) &&
                      (navigator.userAgent.indexOf("rv:1.8") == -1)) ?
0 : 65535;
    }
    if ((event.button == leftButton) && (event.ctrlKey == false))
    {
     ...
    }


This is where I am now. This code seems ugly the reality is that one
version of Gecko accepts the -1 value, the next one accepts the 0
value, the next one accepts the -1 value, etc, etc. It was build
version, after version.

Didier 

--- "Eric H. Jung" <eric.jung at yahoo.com> wrote:

> Didier, did you ever resolve this? I'm about to start checking for
> left
> and right mouse clicks, and would like to learn from your
> difficulties
> :)
> 
> thanks,
> eric
> 
> 
> --- Neil <neil at parkwaycc.co.uk> wrote:
> 
> > Didier Ernotte wrote:
> > 
> > >Is it me or the value of the event.button keeps changing all the
> > time with every new release. In my extension I have some code that
> > tests the value of the left button with
> > >if (event.button == 0) ...
> > >and that was fine up to Mozilla 1.7 . With the preview of FF 1.5
> and
> > the official release of 1.5 and 1.5.0.1 the value have change to 
> > >if (event.button == 65535) ...
> > >and it was ok too with beta of FF 2.0
> > >Now with the FF 1.5.0.2 I was to switch back to 
> > >if (event.button == 0) ...
> > >
> > >Does any body else have the same problem, or can I use an
> attribute
> > of some Interface like EVENT.LEFT_BUTTON to have always the correct
> > value ?
> > >
> > It should always be 0. It is for me in SeaMonkey 1.0 (same Gecko
> > version 
> > as FF 1.5.0.1).
> > _______________________________________________
> > Project_owners mailing list
> > Project_owners at mozdev.org
> > http://mozdev.org/mailman/listinfo/project_owners
> > 
> 
> 
> Use Your PC To Find a Cure for
>
Cancerhttp://members.ud.com/services/teams/team.htm?id=68C9E079-8285-495F-8598-D73352CC7075And
> Join Team Lulu
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



More information about the Project_owners mailing list