27 lines
653 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
When using the Backbone.js framework, the internal hash containing the model's state, ``++model.attributes++``, should not be accessed directly. Doing so bypasses the listeners set on the model and could put your application in a bad state.
Instead, you should use ``++set++`` to update, ``++get++`` to read, and ``++_.clone(model.attributes)++`` to obtain a copy.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
myModel.attributes.someAttribute = 1;
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
myModel.set({ someAttribute: 1 });
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::rspecator-view[]