-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IE "Invalid calling object" error (attach to DOM and then compile) #261
Conversation
…on by adding the uncompiled content to the DOM and then compiling it. For example, if a controller in a lazy loaded module calls $element[0].getElementsByTagName('whatever'), IE will invalidated the returned HTMLCollection once the lazy loaded content is added to the DOM (this is not an issue in Firefox or Chrome). By adding the content and then compiling, we prevent IE from invalidating saved elements. (This issue was encountered when lazy loading a module that uses angular-material's md-tabs, which saves tab elements.)
\o/ a PR with a test!! |
Ahah looks like I just got the bug in one of my projects when I tester in IE. |
Fix IE "Invalid calling object" error (attach to DOM and then compile)
Hmm I still have the same error on IE :-/ |
Sorry to hear that. I'll take a look at master and see if I can reproduce the issue. I was testing with IE11. What version of IE were you testing with? |
It's ok, I fixed it in a new commit :) |
Thanks for tweaking my fix. Your changes look good. I appreciate you working with me on this one and getting it closed quickly! |
@ocombe Sorry to bug you, but can you also publish 1.0.8 to npm? I'm only seeing 1.0.7 currently. Thanks! |
Yes sorry, done ! Thanks for the reminder :) |
Hi. I'm using ocLazyLoad in combination with angular-material and have run into an issue where using
md-tabs
in a lazy loaded module is causing "Invalid calling object" errors in IE11. Inside of the tabs controller, elements are being saved for variables using thegetElementsByTagName()
function. IE is invalidating the saved HTMLCollection objects once the compiled element is added to the parent DOM (this error does not occur in Firefox or Chrome). As a fix, the content should first be added to the parent DOM and then compiled (inocLazyLoad.directive.js
).I've added a test to highlight this error which can be run without the fix on my ie_invalid_test branch. It can be observed by running
gulp karma
(withsingleRun: false
) and then opening IE11 to the karma port. In my tests, IE11 is also failing another test around a missing file, so you may have to focus on the specific test (changeit
tofit
) in order to isolate this issue.I'm also not sure why the build messed with the whitespace on the polyfill. If you like, I can see about cleaning that up. Also, I can file an issue for tracking and discussion, if you like.
Thank you for your time and consideration as well as your excellent work on this very important library!