You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/v4.9.0/configuring-ember/disabling-prototype-extensions.md
+7-25Lines changed: 7 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,13 @@
1
-
By default, Ember.js will extend the prototypes of native JavaScript
2
-
arrays to implement the `Ember.Enumerable`, `Ember.MutableEnumerable`,
3
-
`Ember.MutableArray` and `Ember.Array` interfaces. This polyfills
4
-
ECMAScript 5 array methods in browsers that do not implement them, adds
5
-
convenience methods and properties to built-in arrays, and makes array
6
-
mutations observable.
7
-
8
-
This is the extent to which Ember.js enhances native prototypes. We have
9
-
carefully weighed the trade-offs involved with changing these prototypes,
10
-
and recommend that most Ember.js developers use them. These extensions
11
-
significantly reduce the amount of boilerplate code that must be typed.
12
-
13
-
However, we understand that there are cases where your Ember.js
14
-
application may be embedded in an environment beyond your control. The
15
-
most common scenarios are when authoring third-party JavaScript that is
16
-
embedded directly in other pages, or when transitioning an application
17
-
piecemeal to a more modern Ember.js architecture.
18
-
19
-
In those cases, where you can't or don't want to modify native
20
-
prototypes, Ember.js allows you to completely disable the extensions
21
-
described above.
22
-
23
-
To do so, simply set the `EmberENV.EXTEND_PROTOTYPES` flag to `false`:
1
+
Historically, Ember.js extended the prototypes of native JavaScript arrays to implement the Ember.Enumerable, Ember.MutableEnumerable, Ember.MutableArray, and Ember.Array interfaces. This added convenience methods and properties to built-in arrays, and made array mutations observable.
2
+
3
+
However, as of Ember-cli 4.9.0, prototype extensions are disabled by default in new Ember applications. This change was made to align more closely with standard JavaScript behavior and to avoid potential conflicts with other libraries or future language features.
4
+
5
+
If you have an existing application that relies on prototype extensions, you can still enable them by setting the `EmberENV.EXTEND_PROTOTYPES` flag to `true` in your `config/environment.js` file:
0 commit comments