Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose normalizeUIString #3178

Closed
wants to merge 17 commits into from

Conversation

bazineta
Copy link
Contributor

Expose normalizeUIString, to parallel normalizeUIKeys and
normalizeUIValues, issue #3174.

paulfalgout and others added 17 commits August 20, 2016 03:06
If you were to override `buildChildView` instantiating the childViews with an `el` then you can create a collectionView from pre-rendered DOM
CollectionView can’t be initially “rendered” because it does its initialization of many things on first render.
when a collection view is DOM
* and it's not attached to the document
** should have _isAttached set to false

* and it's attached to the document
** should have _isAttached set to true

when rendering a childView
* should not render childView twice
when a collection view is DOM
* and it's not attached to the document
** should have a child view without `_isAttached`

* and it's attached to the document
** should have a child view with `_isAttached` set to `true`
…view-iso

Allow CollectionView to be populated with pre-rendered DOM
This function removes the need for a `preventDestroy` option.

Essentially if you want to `preventDestroy` just detach the view first. When you want to preventDestroy you already have to have a copy of the view.. and depending on what is doing the view emptying `preventDestroy` can become a round about API.

What you really want is
```js
const myView = myRegion.currentView;
myRegion.detachView();
myOtherRegion.show(myView);
```
* mergeOptions src/common/merge-options.js
* iterate through `keys` and merge instead
  of getting the `keys` from options, then merging

monitor-view-events  src/common/monitor-view-events.js
* Define once:
   triggerDOMRefresh
   handleBeforeAttach
   handleAttach
   handleBeforeDetach
   handleDetach
   handleRender

triggerMethodOn src/common/trigger-method.js
* Distinct if `context` has triggerMethod, use and return result
   with fallback to helper function and return result

CollectionView src/collection-view.js
* private childViewEventHandle for optimization
* _proxyChildEvents using childViewEventHandle

src/common/trigger-method.js
* will remember the last `event` name transform

src/mixins/behaviors.js
takes arraylike value only

src/mixins/view.js
triggerMethod
only passes along `arguments` other functions

* Make trigger on behavior follow same patterns as parent

* Make childViewEventHandler a common module
…arionettejs#3105)

* CollectionView# and CompositeView#

_initialEvents
* Listen to `this.collection~event:update` instead.

_onCollectionUpdate
* pass `options.changed.removed` to `this._removeChildViews`
* updated test to reflect additions

 _removeChildViews
* use array of models to determine what views to remove if not already destroyed.
* Support `checkEmpty` for preventing empty collection checking

_destroyChildren
* checks to see if there are any children to destroy before calling `_removeChildViews`

removeChildView
* using _destroyChildView
* added test for trying to remove falsy and valid values

_getRemovedViews

_removeChildView

- ~~~_onCollectionRemove~~~
* test and references removed

_findGreatestIndexedView
* finds the view with the greatest `_index` and returns it.

_updateIndices
* accepts array of views for _findGreatestIndexedView

[test] when removing the sorted view, the `view._index` should update.

* Attempts to always use models instead of modelOrViews

This may not be helpful.. just wanted to give it one last show.
I don’t think there are perf issues. particularly since `findByModel` is cheap.  In fact I think the complexity of reorder went down.. though I didn’t test it..
detachView
* falsy check

Regions
detachChildView
detachChildView
detachView
[documentation] View#detachChildView
…ChildView

Region detachview detach child view
…marionettejs#3113)

* _createView
* creates view from model and does event monitor and proxyChild events

_renderChildView
* render views and triggers render events

_setupChildView
* sets child view properties:
  parent, _index (conditionally), monitorViewEvents, and  _proxyChildEvents.

* CollectionView

addChildView
* using `_setupChildView`
* triggers `event~before:add:child`
* triggers `event~add:child`
* when buffering, will add view to list of children
  but will not update children length for performance increase
* using `_renderView`

~~_addChildView~~

_updateIndices
* removed need to pass index

_addChild
* removed passing ChildView param
* using `_createView`

_onCollectionAdd
* using `_addChild`

_showCollection
* using `_addChild`
* calls `children._updateLength`

_showEmptyView
* removed unnecessary `view._parent` setting
Expose normalizeUIString, to parallel normalizeUIKeys and
normalizeUIValues, issue marionettejs#3174.
@bazineta bazineta closed this Sep 13, 2016
@bazineta bazineta deleted the expose-normalizeUIString branch September 13, 2016 14:46
@coveralls
Copy link

coveralls commented Sep 13, 2016

Coverage Status

Coverage decreased (-0.2%) to 99.845% when pulling b129a02 on bazineta:expose-normalizeUIString into 70fb35b on marionettejs:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants