Skip to content

Commit

Permalink
Fix issue when passed selector is not a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Kharlampidi committed Jun 17, 2015
1 parent 1f1bdcc commit 548c3d9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/js/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ var View = function (selector, params) {
var container = $(selector);
view.container = container[0];

// Fix Selector

if (typeof selector !== 'string') {
// Supposed to be HTMLElement or Dom7
selector = (container.attr('id') ? '#' + container.attr('id') : '') + (container.attr('class') ? '.' + container.attr('class').replace(/ /g, '.').replace('.active', '') : '');
view.selector = selector;
}

// Is main
view.main = container.hasClass(app.params.viewMainClass);

Expand Down

0 comments on commit 548c3d9

Please sign in to comment.