2021-06-02 20:44:38 +02:00

27 lines
653 B
Plaintext

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.
== Noncompliant Code Example
----
myModel.attributes.someAttribute = 1;
----
== 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[]