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

fix(dialog): IE8 fix to not set data() against text nodes. #339

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
});