-
-
Notifications
You must be signed in to change notification settings - Fork 983
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
TypeError: document.defaultView.getComputedStyle(...) is null #41
Comments
Cool do you want to send me a pull request with the fix. |
Yes - I can do that later today... |
Thanks, now that I'm back home I'm wondering if it could that be reduced down to. retVal = document.defaultView.getComputedStyle(el, null);
retVal = (null !== retVal) ? retVal[prop] : 0; |
Yeah - that is probably better. Would you like me to update the pull request? |
Yeah why not. Also do you fancy writing a qUnit test for this? |
Ok pull request has been updated. I haven't written a qUnit test before... is it easy to learn how? |
Yeah it's pretty straight forward, have a look at the html files in the test folder for some examples, the _init.html is the simplest one. I think you could strip that back to the first assertion that test it got a message back and the create a new iframe contents html page in the resource folder with a simple version of the page that was creating the problem. Once you've done that you can just run 'grunt' and it will automagically run the test along with all the other ones. |
Hmm ok I'll look into it... |
Thanks. |
I get the following error in Firefox 29:
"TypeError: document.defaultView.getComputedStyle(...) is null"
The iframes I am resizing are created dynamically on the page with javascript and are inside a div that has "display: none" - so they are not visible when they are created (I do this because I want to animate the reveal of the iframe's content).
I tracked this problem down to line # 283 in iframeResizer.contentWindow.js:
"retVal = document.defaultView.getComputedStyle(el, null)[prop];"
I have fixed the problem by changing it to:
"retVal = document.defaultView.getComputedStyle(el, null);
if(retVal == null) retVal = {marginTop: 0, marginBottom: 0};
retVal = retVal[prop];"
The text was updated successfully, but these errors were encountered: