
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
857 B
Plaintext
44 lines
857 B
Plaintext
== Why is this an issue?
|
|
|
|
When using the Backbone.js framework, the array of models inside a collection, ``++collection.models++``, should not be accessed directly. Doing so bypasses the listeners set on the collection and could put your application in a bad state.
|
|
|
|
|
|
Instead, use ``++get++``, ``++at++`` or the underscore methods.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
myCollection.models.forEach(function (model) { });
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
myCollection.forEach(function (model) { });
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use "get|at" or the underscore methods instead.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 20 May 2015, 12:32:24 Linda Martin wrote:
|
|
OK!
|
|
|
|
endif::env-github,rspecator-view[]
|