Skip to content

Commit

Permalink
fix(view-slot): add firstChild null checks
Browse files Browse the repository at this point in the history
add null checks for case when firstChild is null.  this occurs when the
aurelia-app attribute is in a child element of body instead of on the
body element, for example

Fixes #34
  • Loading branch information
cmichaelgraham committed Mar 20, 2015
1 parent a49411d commit d260bdb
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/view-slot.js
Expand Up @@ -72,8 +72,7 @@ export class ViewSlot {
view.attached();
// Animate page itself
var element = view.firstChild ? view.firstChild.nextElementSibling : null;
if(view.firstChild !== undefined &&
view.firstChild !== null &&
if(view.firstChild !== null &&
view.firstChild.nodeType === 8 &&
element !== null &&
element.nodeType === 1 &&
Expand Down Expand Up @@ -121,8 +120,7 @@ export class ViewSlot {
};

var element = view.firstChild ? view.firstChild.nextElementSibling : null;
if(view.firstChild !== undefined &&
view.firstChild !== null &&
if(view.firstChild !== null &&
view.firstChild.nodeType === 8 &&
element !== null &&
element.nodeType === 1 &&
Expand All @@ -144,8 +142,7 @@ export class ViewSlot {

children.forEach( (child) => {
var element = child.firstChild ? child.firstChild.nextElementSibling : null;
if(child.firstChild !== undefined &&
child.firstChild !== null &&
if(child.firstChild !== null &&
child.firstChild.nodeType === 8 &&
element !== null &&
element.nodeType === 1 &&
Expand Down Expand Up @@ -202,8 +199,7 @@ export class ViewSlot {
children[i].attached();

var element = children[i].firstChild ? children[i].firstChild.nextElementSibling : null;
if(children[i].firstChild !== undefined &&
children[i].firstChild !== null &&
if(children[i].firstChild !== null &&
children[i].firstChild.nodeType === 8 &&
element !== null &&
element.nodeType === 1 &&
Expand Down

0 comments on commit d260bdb

Please sign in to comment.