diff --git a/bower.json b/bower.json index b4d07e56..6685d2c8 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating", - "version": "1.0.0-beta.3.0.5", + "version": "1.0.0-beta.3.0.6", "description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.", "keywords": [ "aurelia", diff --git a/dist/amd/aurelia-templating.js b/dist/amd/aurelia-templating.js index ae000854..3e32cd45 100644 --- a/dist/amd/aurelia-templating.js +++ b/dist/amd/aurelia-templating.js @@ -1113,12 +1113,18 @@ define(['exports', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pal', 'aureli }; ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) { - var childNodes = view.fragment.childNodes; - var ii = childNodes.length; - var nodes = new Array(ii); + var nodes = void 0; - for (var i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + var childNodes = view.fragment.childNodes; + var ii = childNodes.length; + nodes = new Array(ii); + + for (var i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); @@ -1431,7 +1437,7 @@ define(['exports', 'aurelia-logging', 'aurelia-metadata', 'aurelia-pal', 'aureli children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } }; diff --git a/dist/aurelia-templating.js b/dist/aurelia-templating.js index 9c9f9cb7..33a72ddb 100644 --- a/dist/aurelia-templating.js +++ b/dist/aurelia-templating.js @@ -1332,12 +1332,18 @@ export class ShadowDOM { } static distributeView(view, slots, projectionSource, index, destinationOverride) { - let childNodes = view.fragment.childNodes; - let ii = childNodes.length; - let nodes = new Array(ii); + let nodes; - for (let i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + let childNodes = view.fragment.childNodes; + let ii = childNodes.length; + nodes = new Array(ii); + + for (let i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes( @@ -1821,7 +1827,7 @@ export class View { children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } } diff --git a/dist/commonjs/aurelia-templating.js b/dist/commonjs/aurelia-templating.js index 3d6ba0ce..56f8f633 100644 --- a/dist/commonjs/aurelia-templating.js +++ b/dist/commonjs/aurelia-templating.js @@ -1094,12 +1094,18 @@ var ShadowDOM = exports.ShadowDOM = (_temp3 = _class11 = function () { }; ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) { - var childNodes = view.fragment.childNodes; - var ii = childNodes.length; - var nodes = new Array(ii); + var nodes = void 0; - for (var i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + var childNodes = view.fragment.childNodes; + var ii = childNodes.length; + nodes = new Array(ii); + + for (var i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); @@ -1412,7 +1418,7 @@ var View = exports.View = function () { children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } }; diff --git a/dist/es2015/aurelia-templating.js b/dist/es2015/aurelia-templating.js index 9b5fb471..11470d76 100644 --- a/dist/es2015/aurelia-templating.js +++ b/dist/es2015/aurelia-templating.js @@ -931,12 +931,18 @@ export let ShadowDOM = (_temp3 = _class11 = class ShadowDOM { } static distributeView(view, slots, projectionSource, index, destinationOverride) { - let childNodes = view.fragment.childNodes; - let ii = childNodes.length; - let nodes = new Array(ii); + let nodes; - for (let i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + let childNodes = view.fragment.childNodes; + let ii = childNodes.length; + nodes = new Array(ii); + + for (let i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); @@ -1240,7 +1246,7 @@ export let View = class View { children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } } diff --git a/dist/native-modules/aurelia-templating.js b/dist/native-modules/aurelia-templating.js index e9a7810b..cb89b6e3 100644 --- a/dist/native-modules/aurelia-templating.js +++ b/dist/native-modules/aurelia-templating.js @@ -1059,12 +1059,18 @@ export var ShadowDOM = (_temp3 = _class11 = function () { }; ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) { - var childNodes = view.fragment.childNodes; - var ii = childNodes.length; - var nodes = new Array(ii); + var nodes = void 0; - for (var i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + var childNodes = view.fragment.childNodes; + var ii = childNodes.length; + nodes = new Array(ii); + + for (var i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); @@ -1376,7 +1382,7 @@ export var View = function () { children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } }; diff --git a/dist/system/aurelia-templating.js b/dist/system/aurelia-templating.js index ce545be3..92974b3e 100644 --- a/dist/system/aurelia-templating.js +++ b/dist/system/aurelia-templating.js @@ -1624,12 +1624,18 @@ System.register(['aurelia-logging', 'aurelia-metadata', 'aurelia-pal', 'aurelia- }; ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) { - var childNodes = view.fragment.childNodes; - var ii = childNodes.length; - var nodes = new Array(ii); + var nodes = void 0; - for (var i = 0; i < ii; ++i) { - nodes[i] = childNodes[i]; + if (view === null) { + nodes = noNodes; + } else { + var childNodes = view.fragment.childNodes; + var ii = childNodes.length; + nodes = new Array(ii); + + for (var i = 0; i < ii; ++i) { + nodes[i] = childNodes[i]; + } } ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride); @@ -1928,7 +1934,7 @@ System.register(['aurelia-logging', 'aurelia-metadata', 'aurelia-pal', 'aurelia- children[i].bind(bindingContext, overrideContext, true); } - if (this.hasSlots && this.contentView !== null) { + if (this.hasSlots) { ShadowDOM.distributeView(this.contentView, this.slots); } }; diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 7687ffa6..be603799 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -1,3 +1,13 @@ + +# [1.0.0-beta.3.0.6](https://github.com/aurelia/templating/compare/1.0.0-beta.3.0.5...v1.0.0-beta.3.0.6) (2016-06-19) + + +### Bug Fixes + +* **shadow-dom:** handle elements with no content ([aecc83a](https://github.com/aurelia/templating/commit/aecc83a)), closes [#388](https://github.com/aurelia/templating/issues/388) + + + ### 1.0.0-beta.2.0.1 (2016-05-31) diff --git a/package.json b/package.json index 81246cbc..f4a0b856 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aurelia-templating", - "version": "1.0.0-beta.3.0.5", + "version": "1.0.0-beta.3.0.6", "description": "An extensible HTML templating engine supporting databinding, custom elements, attached behaviors and more.", "keywords": [ "aurelia", diff --git a/src/shadow-dom.js b/src/shadow-dom.js index ae82a6ea..528e9abb 100644 --- a/src/shadow-dom.js +++ b/src/shadow-dom.js @@ -347,7 +347,7 @@ export class ShadowDOM { } else { let childNodes = view.fragment.childNodes; let ii = childNodes.length; - let nodes = new Array(ii); + nodes = new Array(ii); for (let i = 0; i < ii; ++i) { nodes[i] = childNodes[i];