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

Allow extension of chosen prototypes instead of the current all or none. #1449

Merged
merged 2 commits into from Oct 15, 2012

Conversation

Projects
None yet
2 participants
@jdsmith2816

jdsmith2816 commented Oct 15, 2012

The update lets Window.ENV.EXTEND_PROTOTYPES be treated as a hash in order to more granularly control which prototypes are extended by Ember. The updates are backwards compatible with the old boolean definition.

window.Env = {
  EXTEND_PROTOTYPES: {
    Function: true,
    String: true,
    Array: true
  }
}

JD Smith added some commits Sep 5, 2012

JD Smith
Allow extension of chosen prototypes instead of the current all or none.
One of my current projects involves embedding an ember widget into
a rather large pre-existing application   Extending the Array prototype
causes a slew of issues for both first party and third party code
in use on the relevant pages.

This change is backwards compatible and enables, via a new ENV hash,
the ability to choose exactly which prototypes to extend:

window.Env = {
    EXTEND_PROTOTYPES: true,
    PROTOTYPE_EXTENSIONS: {
    //  all: true,
        Function: true,
        String: true,
        Array: true
    }
};

Conflicts:
	packages/ember-metal/lib/core.js
	packages/ember-runtime/lib/ext/function.js
	packages/ember-runtime/lib/system/string.js
JD Smith
Allow extension of chosen prototypes instead of the current all or none
One of my current projects involves embedding an ember widget into
a rather large pre-existing application   Extending the Array prototype
causes a slew of issues for both first party and third party code
in use on the relevant pages.

This change is backwards compatible and enables, via updating the
handling of the ENV.EXTEND_PROTOTYPES variable, the ability to choose
exactly which prototypes to extend:

window.Env = {
    EXTEND_PROTOTYPES: {
        Function: true,
        String: true,
        Array: true
    }
};

If window.ENV.EXTEND_PROTOTYPES is true or undefined
Ember.ENV.EXTEND_PROTOTYPES is initialized to the above hash.

If false it is initialized to the above hash with false intead of
true set for each prototype.

Otherwise it is assuemd to be a hash configured properly for the
application at hand.
@jdsmith2816

This comment has been minimized.

Show comment
Hide comment
@jdsmith2816

jdsmith2816 Oct 15, 2012

This was previously on my master and not in a topic branch; the original pull request was #1349

jdsmith2816 commented Oct 15, 2012

This was previously on my master and not in a topic branch; the original pull request was #1349

wycats added a commit that referenced this pull request Oct 15, 2012

Merge pull request #1449 from jdsmith2816/prototype-extensions
Allow extension of chosen prototypes instead of the current all or none.

@wycats wycats merged commit 1fdb89e into emberjs:master Oct 15, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment