Skip to content

Commit

Permalink
release: 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierBoubert committed Sep 30, 2015
1 parent e06fca0 commit 2d680c7
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 23 deletions.
38 changes: 20 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@ Versions details history. For each version you can find:
* Link to the release branch
* All of the modifications details

<a name="0.5.0"></a>
# 0.5.0 (2015-09-30)

[Release 0.5.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.5.0)

### Breaking changes

- **ractive-require**
- Reset the rv-require element on teardown. It's controller will be fired again on .require().
- Add the "rv-require-loaded" CSS class when the rv-require element is active

<a name="0.4.0"></a>
# 0.4.0 (2015-09-09)

[Release 0.4.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.4.0) -
[Branch release/0.4.0](https://github.com/XavierBoubert/ractive-require/tree/0.4.0)
[Release 0.4.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.4.0)

### Breaking changes

Expand All @@ -21,8 +31,7 @@ Versions details history. For each version you can find:
<a name="0.3.0"></a>
# 0.3.0 (2015-09-08)

[Release 0.3.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.3.0) -
[Branch release/0.3.0](https://github.com/XavierBoubert/ractive-require/tree/0.3.0)
[Release 0.3.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.3.0)

### Breaking changes

Expand All @@ -32,8 +41,7 @@ Versions details history. For each version you can find:
<a name="0.2.4"></a>
# 0.2.4 (2015-06-18)

[Release 0.2.4](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.4) -
[Branch release/0.2.4](https://github.com/XavierBoubert/ractive-require/tree/0.2.4)
[Release 0.2.4](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.4)

### Breaking changes

Expand All @@ -43,8 +51,7 @@ Versions details history. For each version you can find:
<a name="0.2.3"></a>
# 0.2.3 (2015-06-03)

[Release 0.2.3](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.3) -
[Branch release/0.2.3](https://github.com/XavierBoubert/ractive-require/tree/0.2.3)
[Release 0.2.3](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.3)

### Breaking changes

Expand All @@ -54,8 +61,7 @@ Versions details history. For each version you can find:
<a name="0.2.2"></a>
# 0.2.2 (2015-05-27)

[Release 0.2.2](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.2) -
[Branch release/0.2.2](https://github.com/XavierBoubert/ractive-require/tree/0.2.2)
[Release 0.2.2](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.2)

### Breaking changes

Expand All @@ -65,8 +71,7 @@ Versions details history. For each version you can find:
<a name="0.2.1"></a>
# 0.2.1 (2015-05-27)

[Release 0.2.1](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.1) -
[Branch release/0.2.1](https://github.com/XavierBoubert/ractive-require/tree/0.2.1)
[Release 0.2.1](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.1)

### Breaking changes

Expand All @@ -76,8 +81,7 @@ Versions details history. For each version you can find:
<a name="0.2.0"></a>
# 0.2.0 (2015-04-03)

[Release 0.2.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.0) -
[Branch release/0.2.0](https://github.com/XavierBoubert/ractive-require/tree/0.2.0)
[Release 0.2.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.2.0)

### Breaking changes

Expand All @@ -87,8 +91,7 @@ Versions details history. For each version you can find:
<a name="0.1.1"></a>
# 0.1.1 (2015-03-24)

[Release 0.1.1](https://github.com/XavierBoubert/ractive-require/releases/tag/0.1.1) -
[Branch release/0.1.1](https://github.com/XavierBoubert/ractive-require/tree/0.1.1)
[Release 0.1.1](https://github.com/XavierBoubert/ractive-require/releases/tag/0.1.1)

### Breaking changes

Expand All @@ -100,8 +103,7 @@ Versions details history. For each version you can find:
<a name="0.1.0"></a>
# 0.1.0 (2015-03-23)

[Release 0.1.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.1.0) -
[Branch release/0.1.0](https://github.com/XavierBoubert/ractive-require/tree/0.1.0)
[Release 0.1.0](https://github.com/XavierBoubert/ractive-require/releases/tag/0.1.0)

### Breaking changes

Expand Down
40 changes: 38 additions & 2 deletions dist/ractive-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,32 @@
return null;
}

function _cleanCls(element, cls, add, remove) {
var className = element.className || '',
newClassName = [];

className.split(' ').map(function(clsName) {
clsName = clsName.trim();
if (clsName && ((!add && !remove) || clsName != cls)) {
newClassName.push(clsName);
}
});

if (add) {
newClassName.push(cls);
}

element.className = newClassName.join(' ');
}

function _addCls(element, cls) {
_cleanCls(element, cls, true);
}

function _removeCls(element, cls) {
_cleanCls(element, cls, false, true);
}

function _requireElement(parent, element, callback, forceNoScript, forceNoCSS) {
forceNoScript = forceNoScript || false;

Expand All @@ -237,6 +263,7 @@
}

element.setAttribute('loaded', 'true');
_addCls(element, 'rv-require-loaded');

if (!window.Ractive.templates[name]) {

Expand Down Expand Up @@ -265,7 +292,8 @@
}

var template = window.Ractive.templates[name],
databinding = _fetchDataBinding(element, parent);
databinding = _fetchDataBinding(element, parent),
initialHTML = element.innerHTML;

_fetchPartials(element, parent)
.then(function(partials) {
Expand Down Expand Up @@ -297,7 +325,12 @@
observers.push(_createObserver(ractive, parent, databinding.binds[bind], bind));
}

ractive.on('teardown', function() {
var teardownEvent = ractive.on('teardown', function() {
teardownEvent.cancel();

element.removeAttribute('loaded');
_removeCls(element, 'rv-require-loaded');

ractive.parentRequire = null;

var i;
Expand All @@ -322,6 +355,9 @@
ractive.childrenRequire[i].teardown();
}
}

element.innerHTML = initialHTML;
ractive = null;
});

ractive.childrenRequire = [];
Expand Down
2 changes: 1 addition & 1 deletion dist/ractive-require.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d680c7

Please # to comment.