Skip to content

Fix: make echo360.js work in strict mode#158

Open
mindcrunch4u wants to merge 1 commit intoh5p:masterfrom
mindcrunch4u:master
Open

Fix: make echo360.js work in strict mode#158
mindcrunch4u wants to merge 1 commit intoh5p:masterfrom
mindcrunch4u:master

Conversation

@mindcrunch4u
Copy link

Root Cause:

"delete" doesn't work on a variable declared with "let".

Changes:

Assigning the variable "undefined". This has the same effect, and should work in strict mode.

According to the doc:

Normal variables in JavaScript can't be deleted using the delete operator. In strict mode, an attempt to delete a variable will throw an error and is not allowed.

This is affecting h5p users, for example, see this issue.

According to git blame, cc: @otacke

Root Cause:

"delete" doesn't work on a variable declared with "let".

Changes:

Assigning the variable "undefined" has the same effect,
and this will work in strict mode.

According to [the doc](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Delete_in_strict_mode):
> Normal variables in JavaScript can't be deleted using the delete operator. In strict mode, an attempt to delete a variable will throw an error and is not allowed.

This is affecting h5p users, for example, see [this issue](Lumieducation/H5P-Nodejs-library#4197).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant