Skip to content
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

IE7 Invalid argument, unexpected call to method or property access. #17

Open
cabaret opened this issue Sep 27, 2012 · 11 comments
Open

IE7 Invalid argument, unexpected call to method or property access. #17

cabaret opened this issue Sep 27, 2012 · 11 comments

Comments

@cabaret
Copy link

cabaret commented Sep 27, 2012

I keep getting spammed with errors in IE7.

The page loads broken, then starts flickering between the working boxsizing version and the broken one. Every 0.5 seconds it shows me a working version, then goes back to broken.

I get the following error in IE7 (IE9 on IE7 mode, since the error message in IE7 tell me nothing useful at all.)

SCRIPT87: Invalid argument. 
boxsizing.htc, line 374 character 2

Line 374 is the line below which starts with element...

function setBorderBoxMinHeight(n){
        element.runtimeStyle.minHeight = Math.max(0, n - getBorderTopWidth() -
        getPaddingTop() - getPaddingBottom() - getBorderBottomWidth()) + "px";
}

I also, sometimes, get the following error:

SCRIPT65535: Unexpected call to method or property access.
boxsizing.htc, line 323 character 2

These lines:

function getBoxSizing(){
var s = element.style;
var cs = element.currentStyle
if(typeof s.boxSizing != "undefined" && s.boxSizing != ""){
    return s.boxSizing;
}
if(typeof s["box-sizing"] != "undefined" && s["box-sizing"] != ""){
    return s["box-sizing"];
}
if(typeof cs.boxSizing != "undefined" && cs.boxSizing != ""){
    return cs.boxSizing;
}
if(typeof cs["box-sizing"] != "undefined" && cs["box-sizing"] != ""){
    return cs["box-sizing"];
}
return getDocumentBoxSizing();
}

I'm testing this with the latest version of boxsizing.htc.

@marcoliverteschke
Copy link

So apparently sometimes the parameter n of setBorderBoxMinHeight is the dreaded NaN. When this occurs, IE7 throws a massive hissy fit.

Maybe setting

if(isNaN(n))
  n = 0;

would suffice as a fix?

@IbeVanmeenen
Copy link

I'm also having the same error:
SCRIPT65535: Unexpected call to method or property access.
boxsizing.htc, line 323 character 2

Witch causes IE7 to crash...
Looking in to it.

@bekapod
Copy link

bekapod commented Nov 1, 2012

Was a solution ever found for:
SCRIPT65535: Unexpected call to method or property access.
boxsizing.htc, line 323 character 2 ?

@IbeVanmeenen
Copy link

Not yet...
We had to just leave it out of our project and write some css for IE7...

@jdelStrother
Copy link

As far as I can tell it happens when getPixelHeight returns 'auto', which it does for an awful lot of cases. I've worked around it using :

@@ -467,7 +467,7 @@ function updateBorderBoxHeight() {
        csh = element.currentStyle.minHeight;
        if(csh != "none"){
                csh = getPixelHeight(element,csh);
-               if(csh !== "none"){
+               if(csh !== "none" && csh != "auto"){
                        if(getBoxSizing() == "border-box"){
                                setBorderBoxMinHeight(parseInt(csh));
                        }

... though I'm not entirely sure if that's the correct fix.

@jdelStrother
Copy link

I've also been getting the "Unexpected call to method or property access" error on trying to access 'element' from within the resizetimeout callback. It kinda seems like 'element' is no longer in scope once the timeout fires. I ended up capturing a local variable called 'theElement' -

 <attach event="onresize" for="window" onevent="update()" />
 <script type="text/javascript">
 //<![CDATA[
-var viewportwidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : element.document.documentElement.clientWidth);
+var theElement = element;
+var viewportwidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : theElement.document.documentElement.clientWidth);

 // Shortcut for the document object
-var doc = element.document;
+var doc = theElement.document;

 // Buffer for multiple resize events

- and replacing all occurrences of 'element' with 'theElement', which appears to have fixed things. 😦

@SpoBo
Copy link

SpoBo commented Dec 21, 2012

@jdelStrother it fixes the error but the CPU usage is still 100%. So I'm afraid it's unusable :( I also tried the theELement trick but that broke the script for me.

@aaronwaldon
Copy link

@jdelStrother Thanks for the fix! I was going crazy trying to figure out how to get this polyfill to work with IE7, and your theElement solution worked. :)

@gmclelland
Copy link

@jdelStrother - your comment above #17 (comment) fixed the js error for me in ie7. Thank you

@mariomelchor
Copy link

I was getting the error when body or html element had some sort of height.
Comment #17 fixed the js error for me in ie7 as well. Thanks.

@DrColossos
Copy link

@marcoliverteschke your comment to check for isNaN worked solved many problemes (as well as CPU loads for us). Thanks a lot! This fix should go into the repository as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants