Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
fix(dialog): IE8 fix to not set data() against text nodes
Browse files Browse the repository at this point in the history
Closes #328
  • Loading branch information
jonbcard authored and pkozlowski-opensource committed Apr 23, 2013
1 parent 661c303 commit a6c540e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ dialogModule.provider("$dialog", function(){

if (self.options.controller) {
var ctrl = $controller(self.options.controller, locals);
self.modalEl.contents().data('ngControllerController', ctrl);
self.modalEl.children().data('ngControllerController', ctrl);
}

$compile(self.modalEl)($scope);
Expand Down
20 changes: 19 additions & 1 deletion src/dialog/test/dialog.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('Given ui.bootstrap.dialog', function(){

var $document, $compile, $scope, $rootScope, $dialog, q, provider;
var template = '<div>I\'m a template</div>';
var template = '<div>I\'m a template</div> ';

beforeEach(module('ui.bootstrap.dialog'));
beforeEach(module('template/dialog/message.html'));
Expand Down Expand Up @@ -287,4 +287,22 @@ describe('Given ui.bootstrap.dialog', function(){
expect($document.find('body > div.modal > div.modal-header').length).toBe(1);
});
});

describe('when opening it with a template containing white-space', function(){

var controllerIsCreated;
function Controller($scope, dialog){
controllerIsCreated = true;
}

beforeEach(function(){
createDialog({
template:' <div>Has whitespace that IE8 does not like assigning data() to</div> ',
controller: Controller
});
openDialog();
});

dialogShouldBeOpen();
});
});

0 comments on commit a6c540e

Please sign in to comment.