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: Error thrown on every click when using jquery-ujs #373

Closed
markbao opened this issue Apr 22, 2014 · 1 comment
Closed

IE7: Error thrown on every click when using jquery-ujs #373

markbao opened this issue Apr 22, 2014 · 1 comment
Labels

Comments

@markbao
Copy link

markbao commented Apr 22, 2014

Problem: When using jquery-ujs, clicking anything (link or not) in the document results in a "Wrong number of arguments or invalid property assignment" error in IE7. This results in click-bound actions (such as data-method) failing to work.

It refers to the following code in jquery.js but only throws that error when jquery-ujs is used:

// Support: IE<8
// Prevent attribute/property "interpolation"
// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( div ) {
    div.innerHTML = "<a href='#'></a>";
    return div.firstChild.getAttribute("href") === "#" ;
}) ) {
    addHandle( "type|href|height|width", function( elem, name, isXML ) {
        if ( !isXML ) {
            return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
        }
    });
}

The suspect line that the Microsoft Script Debugger marks is return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );.

Versions:

  • jquery-rails 3.1.0
  • jQuery 1.11.0
  • Internet Explorer 7.0.6002.18005
  • Windows Vista SP2 — Microsoft modern.IE VM
  • Rails 4.1

Call stack: https://gist.github.com/markbao/11187918 — Interestingly, this bug only elicits itself when ujs is included, but the trace only seems to refer to jquery.js.

@jeremy
Copy link
Member

jeremy commented Aug 7, 2014

Looks like jquery-ujs is tickling a jquery bug.

Related stuff working around getAttribute specifics:
http://bugs.jquery.com/ticket/10299
http://bugs.jquery.com/ticket/12915

I tried tracing it further, but ended up looking through https://github.com/jquery/sizzle git history. Unclear.

@jeremy jeremy closed this as completed Aug 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants