
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
44 lines
872 B
Plaintext
44 lines
872 B
Plaintext
== Why is this an issue?
|
|
|
|
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
|
|
|
|
[source,javascript]
|
|
----
|
|
myModel.attributes.someAttribute = 1;
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
myModel.set({ someAttribute: 1 });
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use "(set|get)" instead.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 20 May 2015, 12:33:22 Linda Martin wrote:
|
|
ok!
|
|
|
|
endif::env-github,rspecator-view[]
|