Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide or don't minify extra internal properties on binding context #2296

Merged
merged 1 commit into from
Sep 25, 2017

Conversation

bennieswart
Copy link
Contributor

It is possible for properties such as _subscribable to be created on a
binding context, which, after minification, could be renamed to any
arbitrary character. In most cases this is not an issue, except when a
global variable with the same name exists, however rare the case may be.
This causes the global variable to be shadowed in all bindings, which is
especially problematic in the case of, say, $, which breaks jquery.

To fix this, either hide such properties with a Symbol, or simply don't
minify them so that the name is constant and predictable.

Fixes #2294

It is possible for properties such as `_subscribable` to be created on a
binding context, which, after minification, could be renamed to any
arbitrary character. In most cases this is not an issue, except when a
global variable with the same name exists, however rare the case may be.
This causes the global variable to be shadowed in all bindings, which is
especially problematic in the case of, say, `$`, which breaks jquery.

To fix this, either hide such properties with a Symbol, or simply don't
minify them so that the name is constant and predictable.

Fixes knockout#2294
@mbest mbest merged commit 19d5022 into knockout:master Sep 25, 2017
@mbest
Copy link
Member

mbest commented Sep 25, 2017

Thanks the contribution. This looks good!

@bennieswart bennieswart deleted the context_properties_no_minify branch January 12, 2019 07:56
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.

Binding context exports unnecessary properties which could shadow globals.
2 participants