dennismonsewicz
dennismonsewicz

Reputation: 25542

IE7 and Javascript "An Error as occurred" pop-up

I am working with a Rails 3.1 app that is having the hardest time in IE7. I keep getting the "An error has occurred in the script on this page" everytime I click into an input field. I have the IE debugbar but in Rails the assets are compressed so you can't really debug the issue at hand.

As anyone else ran into this issue and if so, how did you fix it?

Edit

Here is where its "failing" in IE7 (jquery.js file)

attr: function( elem, name, value, pass ) {
    var ret, hooks, notxml,
        nType = elem.nodeType;

    // don't get/set attributes on text, comment and attribute nodes
    if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
        return;
    }

    if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
        return jQuery( elem )[ name ]( value );
    }

    // Fallback to prop when attributes are not supported
    if ( typeof elem.getAttribute === "undefined" ) {
        return jQuery.prop( elem, name, value );
    }

    notxml = nType !== 1 || !jQuery.isXMLDoc( elem );

    // All attributes are lowercase
    // Grab necessary hook if one is defined
    if ( notxml ) {
        name = name.toLowerCase();
        hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
    }

    if ( value !== undefined ) {

        if ( value === null ) {
            jQuery.removeAttr( elem, name );
            return;

        } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
            return ret;

        } else {
            elem.setAttribute( name, "" + value );
            return value;
        }

    } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
        return ret;

    } else {
                    // FAILING HERE WITH THIS LINE
        ret = elem.getAttribute( name );

        // Non-existent attributes return null, we normalize to undefined
        return ret === null ?
            undefined :
            ret;
    }
},

Im not sure why this is failing, but it is.

Upvotes: 0

Views: 323

Answers (1)

weexpectedTHIS
weexpectedTHIS

Reputation: 3376

Run it in development mode and don't compress the javascript files so you can actually debug it.

Upvotes: 1

Related Questions