P5.js: bug in npm bundle

Created on 26 Nov 2019  路  7Comments  路  Source: processing/p5.js

I ran the npm bundle "p5" : "^0.10.2" through the google clojure compiler and got
an error in line 69565: "Invalid delete operand. Only properties can be deleted.".
The culprit seems to be "delete this".

I assume this function has a bug.

dom bug help wanted

Most helpful comment

Actually I just quickly removed it. Thanks for the help everyone!

All 7 comments

Welcome! 馃憢 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

Hi! Thanks for the issue.

I think that this line must be the culprit. I think the intent of this line can be achieved by deleting the reference in this._pInst._elements. Any interest in opening a pull request and contributing a quick fix?

Sorry I don't know enough about p5 to fix the issue. I think with a good linter this
error also should have popped up.

New contributors are always welcome, regardless of prior experience or knowledge!

For now I will add a help wanted label but the to-do is to:

  1. Follow these instructions on setting up a development environment
  2. In the previously linked instructions, when asked to make changes to the code go to this line in src/dom/dom.js and replace it with something like:
// feel free to modify this code to preference as long as the result is the same
const index = this._pInst._elements.indexOf(this);
if (index !== -1) {
  this._pInst._elements.splice(index, 1);
}
  1. Follow the rest of the instruction from step 1. and open a pull request.

I'm confused. The Closure Compiler is explictely complaining about delete this;. So this line which is still there?

https://github.com/processing/p5.js/blob/74e8d1ebdc3cf3c64b0faacaff5fabf1a50f9e1a/src/dom/dom.js#L2092

Not sure what the other code actually does but the Closure Compiler was complaining about delete this when reporting "Invalid delete operand. Only properties can be deleted.".

My apologies @thheller early morning code review and I missed that the delete this line wasn't removed. The other code replaces delete this now we just need to remove the actual line delete this. 馃槄

@mojosoeun would you like to remove the line delete this? and open a pull request?

Actually I just quickly removed it. Thanks for the help everyone!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

b0nb0n picture b0nb0n  路  3Comments

Patchy12 picture Patchy12  路  3Comments

slowizzm picture slowizzm  路  3Comments

aman-tiwari picture aman-tiwari  路  3Comments

aferriss picture aferriss  路  3Comments