From fa05d2d0bbe48a4056b43da71620180d44e6ac11 Mon Sep 17 00:00:00 2001 From: Jeff Bellsey Date: Fri, 15 Aug 2014 23:14:11 -0700 Subject: [PATCH] Bugfix: Trim inner content If the smoothState object started with a blank line, parser would choke. Trimming the input string before passing it to jQuery for parsing fixes the bug. --- jquery.smoothState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.smoothState.js b/jquery.smoothState.js index 14ce99c..e5135e2 100644 --- a/jquery.smoothState.js +++ b/jquery.smoothState.js @@ -208,7 +208,7 @@ getContentById: function (id, $html) { $html = ($html instanceof jQuery) ? $html : utility.htmlDoc($html); var $insideElem = $html.find(id), - updatedContainer = ($insideElem.length) ? $insideElem.html() : $html.filter(id).html(), + updatedContainer = ($insideElem.length) ? $.trim($insideElem.html()) : $html.filter(id).html(), newContent = (updatedContainer.length) ? $(updatedContainer) : null; return newContent; }, @@ -565,4 +565,4 @@ /** Defines the smoothState plugin */ $.fn.smoothState = declareSmoothState; -})(jQuery, window, document); \ No newline at end of file +})(jQuery, window, document);