md-tabs inside of md-dialog on IE11 throws exceptions
When use md-tab inner md-dialog and run on IE 11, I receive a bug when re-size window.
- step one: https://material.angularjs.org/latest/#/demo/material.components.dialog open in code pen
- change md-dialog-content with tab https://material.angularjs.org/latest/#/demo/material.components.tabs
@Splaktar - can you repro in 0.11.0-rc2 or higher.
@tsdragon0404 do you have a CodePen for this?
Which md-dialog in the demo are you testing the tab in? Alert? Confirm? Custom?
What 'bug' do you receive when you resize the window? Please explain what is happening and how it differs from what you expect to happen.
@Splaktar I have created a CodePen for this https://codepen.io/anon/pen/pjNVjv
Please review file attached. Thanks

OK, thank you. That CodePen works like a charm!
TypeError: Invalid calling object
at isArrayLike (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js:276:3)
at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js:332:12)
at shouldPaginate (https://material.angularjs.org/HEAD/angular-material.js:21732:5)
at updatePagination (https://material.angularjs.org/HEAD/angular-material.js:21779:5)
at Anonymous function (https://material.angularjs.org/HEAD/angular-material.js:892:11)
at Anonymous function (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js:17788:11)
at completeOutstandingRequest (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js:5498:7)
at Anonymous function (https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.js:5775:7)
In AngularJS 1.3.19:
TypeError: Invalid calling object
at isArrayLike (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.19/angular.js:266:3)
at forEach (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.19/angular.js:322:12)
at shouldPaginate (https://material.angularjs.org/HEAD/angular-material.js:21732:5)
at updatePagination (https://material.angularjs.org/HEAD/angular-material.js:21779:5)
at Anonymous function (https://material.angularjs.org/HEAD/angular-material.js:892:11)
at Anonymous function (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.19/angular.js:16413:11)
at completeOutstandingRequest (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.19/angular.js:4940:7)
at Anonymous function (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.19/angular.js:5328:7)
I'm seeing additional tab related issues on v0.11.2. IE11 tabs look fine, but Chrome and Edge do not.
On Chrome:
On Edge:
This exception is due to the following function throwing an exception only on IE11:
function updatePagingWidth() {
var width = 1;
angular.forEach(elements.dummies, function (element) { width += element.offsetWidth; });
angular.element(elements.paging).css('width', width + 'px');
}
elements.dummies is not valid on IE11 whereas in Chrome, it contains a valid HTMLCollection:
dummies: HTMLCollection[3]
0: md-dummy-tab#tab-item-8.md-tab.ng-scope.ng-isolate-scope
1: md-dummy-tab#tab-item-9.md-tab.ng-scope.ng-isolate-scope
2: md-dummy-tab#tab-item-10.md-tab.ng-scope.ng-isolate-scope
length: 3
tab-item-8: md-dummy-tab#tab-item-8.md-tab.ng-scope.ng-isolate-scope
tab-item-9: md-dummy-tab#tab-item-9.md-tab.ng-scope.ng-isolate-scope
tab-item-10: md-dummy-tab#tab-item-10.md-tab.ng-scope.ng-isolate-scope
__proto__: HTMLCollection
On IE11:
dummies [object HTMLCollection]
length Invalid calling object
Calling getElements().dummies instead of elements.dummies seems to resolve this issue. I'm working to find a more elegant and performant solution.
This is fixed in https://github.com/angular/material/pull/5096 but it is waiting on review and merging at this time.
@Splaktar Thanks for the fix. I'm still getting "Invalid calling object" errors in IE11 around the tabs controller. Any call that uses getElements() is fine now, but methods that reference elements are still susceptible to this error. For example, fixOffset has elements.tabs.length, which is causing an "Invalid calling object" error in IE11 in my app.
In the end, this fix is a workaround because we don't understand why IE is invaliding these HTMLCollection objects. Does anyone know why IE is invalidating these objects? Is the DOM being modified? Is IE garbage collecting the object inappropriately?
Any insight here would be appreciated. Thanks!
Dug a bit more and found in my case that IE was invalidating DOM references when using ocLazyLoad, which compiles and then attaches the compiled element to the parent DOM. So, IE appears to invalidate DOM references when elements are attached to the parent DOM. (This is not the observed behavior in Firefox or Chrome.) I'm working on an ocLazyLoad fix to first attach the uncompiled element to the DOM and then compile it.
FYI this is still an issue. It seems that when the element.contents() get compiled in compileTemplate, IE looses the references. I managed to work around it by adding a $mdUtil.nextTick after the compilation is done and updating the references to elements from there. It's not ideal, but should be better than having to re-run it multiple times later on.