Fix undeclared var "br" in Search bindings and function callbacks #57
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Same as pull: #49 but for master branch after merge with V 2.x
There are a number of places where variable
br
is called (used as a local context alias tothis
) without being declared or assumed as a global without being such. This breaks the binding between Search form and their callbacks. The only other workaround without this patch is to copy the affected methods and reimplement them in your own extension.Seems like this is because of some left overs/partial update from an upstream merge.
at #49 there where some concerns:
Probably in some places. The reason i did not go for that is that the current coding style( legacy but still present after the big merge) was to copy this context to a local scope var to ensure context separation and correct reference in case the overriding functions and build in callback scopes (even if partial) If
br
should be changed by this completely, some extra testing and a global find and replace could be needed but also a few are not removable at all ( all the ones refered by (https://github.com/internetarchive/bookreader/pull/49/files#diff-4817873ad739c71edef8536417a6c04dR4234)Local tests passed: That is where the decision on keeping 1. as it is right now makes more sense:
br
is bound to this before the callbacks are defined. In that way, when used it is accessed as a local global with the correct parent context already saved as in https://github.com/internetarchive/bookreader/pull/49/files#diff-4817873ad739c71edef8536417a6c04dR4242 there the binding happens before the callback so br refers to the parent this.Interested parties:
@rchrd2