Skip to content

Commit

Permalink
Bump and build v4
Browse files Browse the repository at this point in the history
Moves build back to `lib/` directory to keep old jsfiddles backwards compatible.
  • Loading branch information
paulfalgout committed Apr 20, 2019
1 parent 80f0018 commit f3ebdb7
Show file tree
Hide file tree
Showing 15 changed files with 6,132 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "backbone.marionette",
"description": "The Backbone Framework",
"homepage": "https://marionettejs.com/",
"version": "4.0.0",
"main": "./dist/backbone.marionette.js",
"version": "4.1.0",
"main": "./lib/backbone.marionette.js",
"license": "MIT",
"keywords": [
"backbone",
Expand Down
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
### v4.1.0 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v4.0.0...v4.1.0)

#### Features
* `CollectionView#addChildView` now accepts a `preventRender` option.
* Marionette now uses `el.ownerDocument.documentElement;` by default instead of `document.documentElement` for querying, customizable via `DomApi.getDocumentEl`.
* The UMD build now reinstates `noConflict` for using multiple versions on the global scope.

#### Fixes
* Fixed a case where a child view could potentially get multiple `destroy` events.
* Pre-rendered views from outside of a region will now correctly empty an current view in a region if shown.
* `CollectionView`'s `emptyView` will now respect the `childViewContainer` for attachment.

#### Misc
* Updated backbone dependency to allow for 1.4 without a warning.
* Tooling and testing was updated and improved removing gulp.
* `Region._setElement` was added for internal use, but may be made public in a future release.

### v4.0.0 [view commit logs](https://github.com/marionettejs/backbone.marionette/compare/v3.5.1...v4.0.0)

#### Breaking Changes
Expand Down
4 changes: 3 additions & 1 deletion docs/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ patterns etc.
## Using ES6 Modules

Marionette still supports using the library via an inline script.
The UMD build supports `noConflict()`.

```html
<script src="./backbone.marionette.js"></script>
<script>new Marionette.View({ el: 'body' });</script>
<script>const MyMarionette = Marionette.noConflict();</script>
<script>new MyMarionette.View({ el: 'body' });</script>
```

The recommended solution is to choose a solution like a [package manager](./installation.md)
Expand Down
8 changes: 8 additions & 0 deletions docs/dom.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ API. You will, however, [need to also handle Backbone's jQuery integration](#bac
Returns a new HTML DOM node instance. The resulting node can be passed into the
other DOM functions.

### `getDocumentEl(el)`

Look up the top level element of `el`. Used by Marionette to determine attachment.

```javascript
const elIsAttached = this.Dom.hasEl(this.Dom.getDocumentEl(this.el), this.el);
```

### `getEl(selector)`

Lookup the `selector` string withing the DOM. The `selector` may also be a DOM element.
Expand Down
27 changes: 24 additions & 3 deletions docs/marionette.collectionview.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,10 @@ the `children` of the `CollectionView` can be manually managed.
### Adding a Child View

The `addChildView` method can be used to add a view that is independent of your
`Backbone.Collection`. This method takes two parameters, the child view instance
and optionally the index for where it should be placed within the
[CollectionView's `children`](#managing-children). It returns the added view.
`Backbone.Collection`. This method takes three parameters, the child view instance,
optionally the index for where it should be placed within the
[CollectionView's `children`](#managing-children), and an options hash.
It returns the added view.

```javascript
import { CollectionView } from 'backbone.marionette';
Expand All @@ -677,6 +678,26 @@ myCollectionView.render();
**Note** Unless an index is specified, this added view will be subject to filtering
and sorting and may be difficult to manage in complex situations. Use with care.

**Errors** An error will be thrown if the view is already shown in a Region or CollectionView.

#### `preventRender` option

If you wish to add a child view to the children without the collectionview rendering
the children use the `preventRender` option.

```javascript
import { CollectionView } from 'backbone.marionette';
import ButtonView from './button-view';

const myCollectionView = new CollectionView({...});

const insertIndex = 0; // Add to the top

myCollectionView.addChildView(new ButtonView(), { preventRender: true, index: insertIndex });
myCollectionView.addChildView(new ButtonView(), insertIndex, { preventRender: true });
myCollectionView.addChildView(new ButtonView()); // renders all three children
```

### Removing a Child View

The `removeChildView` method is useful if you need to remove and destroy a view from
Expand Down
4 changes: 3 additions & 1 deletion docs/marionette.region.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ Both forms take an `options` object that will be passed to the
For more information on `showChildView` and `getChildView`, see the
[Documentation for Views](./marionette.view.md#managing-children)

**Errors** An error will be thrown if the view is falsy or destroyed.
**Errors**
- An error will be thrown if the view is falsy or destroyed.
- An error will be thrown if the view is already shown in a Region or CollectionView.

### Checking whether a region is showing a view

Expand Down
Loading

0 comments on commit f3ebdb7

Please sign in to comment.