Documentation bug in Add-on SDK Annotator example

UNCONFIRMED
Unassigned

Status

Mozilla Labs
Jetpack SDK
UNCONFIRMED
6 years ago
6 years ago

People

(Reporter: David Y. Kay, Unassigned)

Tracking

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 602629 [details]
Screen Shot 2012-03-03 at 1.24.50 PM.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Build ID: 20120215223356

Steps to reproduce:

I was working through the Add-On SDK 1.5 examples at: https://addons.mozilla.org/en-US/developers/docs/sdk/latest/dev-guide/addon-development/annotator/widget.html

And found that the first code example, "The Widget's Content Script," is broken. It's missing some boolean operators.


Actual results:

Source code example reads:

this.addEventListener('click', function(event) {
  if(event.button == 0  event.shiftKey == false)
    self.port.emit('left-click');
 
  if(event.button == 2 || (event.button == 0  event.shiftKey == true))
    self.port.emit('right-click');
    event.preventDefault();
}, true);



Expected results:

It should read:

this.addEventListener('click', function(event) {
  if(event.button == 0 && event.shiftKey == false)
    self.port.emit('left-click');

  if(event.button == 2 || (event.button == 0 && event.shiftKey == true))
    self.port.emit('right-click');
    event.preventDefault();
}, true);
(Reporter)

Comment 1

6 years ago
My first bug on here. Sorry if this is in the wrong place!
Component: Untriaged → Jetpack SDK
Product: Firefox → Mozilla Labs
QA Contact: untriaged → jetpack-sdk
Hey David!
The link that you informed in not working. Could you please send me the link again? Thanks!
You need to log in before you can comment on or make changes to this bug.