Merge pull request #8440 from atom/tj-expand-getview-docs

Document the view resolution algorithm
This commit is contained in:
Thomas Johansen
2015-08-19 20:57:41 +02:00

View File

@@ -124,6 +124,22 @@ class ViewRegistry
# * `object` The object for which you want to retrieve a view. This can be a
# pane item, a pane, or the workspace itself.
#
# ## View Resolution Algorithm
#
# The view associated with the object is resolved using the following
# sequence
#
# 1. Is the object an instance of `HTMLElement`? If true, return the object.
# 2. Does the object have a property named `element` with a value which is
# an instance of `HTMLElement`? If true, return the property value.
# 3. Is the object a jQuery object, indicated by the presence of a `jquery`
# property? If true, return the root DOM element (i.e. `object[0]`).
# 4. Has a view provider been registered for the object? If true, use the
# provider to create a view associated with the object, and return the
# view.
#
# If no associated view is returned by the sequence an error is thrown.
#
# Returns a DOM element.
getView: (object) ->
return unless object?