From 2b23957558b19e78fc4cc50acc3ad4b96fb1c984 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Tue, 11 Nov 2014 21:48:09 -0600 Subject: [PATCH] fix(nav): correct element structure for nav-vew Ensure that the entering view template is contained by one element, and that one element has the `pane` class. --- js/angular/service/viewSwitcher.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/js/angular/service/viewSwitcher.js b/js/angular/service/viewSwitcher.js index b380eae861..d63a7e882c 100644 --- a/js/angular/service/viewSwitcher.js +++ b/js/angular/service/viewSwitcher.js @@ -8,10 +8,11 @@ IonicModule '$timeout', '$compile', '$controller', + '$document', '$ionicClickBlock', '$ionicConfig', '$ionicNavBarDelegate', -function($timeout, $compile, $controller, $ionicClickBlock, $ionicConfig, $ionicNavBarDelegate) { +function($timeout, $compile, $controller, $document, $ionicClickBlock, $ionicConfig, $ionicNavBarDelegate) { var TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend'; var DATA_NO_CACHE = '$noCache'; @@ -36,19 +37,16 @@ function($timeout, $compile, $controller, $ionicClickBlock, $ionicConfig, $ionic function createViewElement(viewLocals) { - var div = jqLite('
'); + var containerEle = $document[0].createElement('div'); if (viewLocals && viewLocals.$template) { - div.html(viewLocals.$template); - var nodes = div.contents(); - for (var i = 0; i < nodes.length; i++) { - if (nodes[i].nodeType == 1) { - // first try to get just a child element - return nodes.eq(i); - } + containerEle.innerHTML = viewLocals.$template; + if (containerEle.children.length === 1) { + containerEle.children[0].classList.add('pane'); + return jqLite(containerEle.children[0]); } } - // fallback to return the div so it has one parent element - return div; + containerEle.className = "pane"; + return jqLite(containerEle); } function getViewElementIdentifier(locals, view) {