Skip to main content

Bug Tracker

Side navigation

#1591 closed bug (fixed)

Opened September 11, 2007 06:33PM UTC

Closed May 01, 2011 09:20PM UTC

Last modified March 09, 2012 03:20AM UTC

IE "Invalid Argument" $('table').attr('non-existent')

Reported by: jdsharp Owned by: timmywil
Priority: high Milestone: 1.6
Component: attributes Version: 1.2
Keywords: Cc:
Blocked by: Blocking:
Description

IE 6 throws an "Invalid Argument" error when attempting to get an attribute from a table element. Functions as desired with a div (returns undefined). Fix attached. (Is broken in 1.1.3.1, 1.1.4, 1.2)

Attachments (3)
  • attr.html (0.7 KB) - added by jdsharp September 11, 2007 06:34PM UTC.

    Test case

  • ie-table-attr-namespace.patch (2.1 KB) - added by jdsharp June 03, 2008 04:29PM UTC.

    Patch against 5711

  • jquery-1.2.js (77.8 KB) - added by jdsharp September 11, 2007 06:34PM UTC.

    Changes at line 860

Change History (17)

Changed September 13, 2007 04:57PM UTC by jdsharp comment:1

Some more research reveled that this only occurs when the attribute in question contains a ':'. Updated patch as follows:

Fixes a getAttribute 'Invalid Exception' error when getting an attribute

with a ':' in it on a table element when the attribute does not exist

http:www.andrewdupont.net/2007/01/10/code-hasattribute-for-ie/

if ( jQuery.browser.msie ) {

if ( /href|src/.test(name) && !jQuery.isXMLDoc(elem) )

return elem.getAttribute( name, 2 );

if ( name.indexOf(':') > -1 )

return ( elem.attributes[name] != undefined ? elem.getAttribute(name) : undefined );

}

return elem.getAttribute( name );

Changed September 16, 2007 12:23AM UTC by digitalspagh comment:2

Replying to [comment:1 jdsharp]:

Some more research reveled that this only occurs when the attribute in question contains a ':'. Updated patch as follows: Fixes a getAttribute 'Invalid Exception' error when getting an attribute with a ':' in it on a table element when the attribute does not exist http:www.andrewdupont.net/2007/01/10/code-hasattribute-for-ie/ if ( jQuery.browser.msie ) { if ( /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) return elem.getAttribute( name, 2 ); if ( name.indexOf(':') > -1 ) return ( elem.attributes[name] != undefined ? elem.getAttribute(name) : undefined ); } return elem.getAttribute( name );

Tried the above patch, does not fix the error in IE6, however this did fix a problem I was having in Safari on Windows XP. I was trying to use hover() and hoverIntent() on an unordered list, and neither worked - however this fix solved the problem

Changed January 16, 2008 06:02PM UTC by jdsharp comment:3

This bug is still present in 1.2.2 and the same patch still applies.

Changed May 16, 2008 06:13PM UTC by flesler comment:4

milestone: 1.2.11.2.4
resolution: → fixed
status: newclosed

Tested this with the trunk version, and it works fine.

This was probably fixed with the recent massive modifications to .attr().

I tested on IE6.

Changed June 03, 2008 04:14PM UTC by jdsharp comment:5

resolution: fixed
status: closedreopened

This issue still existed in 1.2.6, I've created a patch against trunk

Changed June 03, 2008 08:38PM UTC by flesler comment:6

owner: → flesler
status: reopenednew

Changed June 03, 2008 08:38PM UTC by flesler comment:7

status: newassigned

Changed February 11, 2009 03:22PM UTC by moxiecode comment:8

Any progress on this one? It's been 8 months and I'm still able to reproduce this in jQuery 1.3.1.

Changed May 16, 2009 03:05PM UTC by dmethvin comment:9

See the discussion in dup #3278

Changed March 31, 2011 04:36PM UTC by danheberden comment:10

_comment0: Still an issue - though IE9 fails on all three :/ \ \ http://jsfiddle.net/danheberden/YxRUP/1301589806081672
_comment1: Still an issue - IE9 can't get at all on a table element :/ \ \ http://jsfiddle.net/danheberden/YxRUP/1301590381842459
milestone: 1.2.41.next

Still an issue - IE9 can't get at all on a table element :/

however, document.getElementById( 'table1' ).getAttribute( 'ric:attrib' )

works just fine

http://jsfiddle.net/danheberden/YxRUP/

Changed March 31, 2011 05:10PM UTC by timmywil comment:11

What about http://jsfiddle.net/timmywil/YxRUP/2/? I don't have IE9 to test.

Changed March 31, 2011 05:13PM UTC by timmywil comment:12

Actually, still a problem in IE6 in that test.

Changed April 18, 2011 12:05AM UTC by john comment:13

owner: flesler
status: assignedopen

Updated version of the test case using jQuery git: http://jsfiddle.net/YxRUP/3/

Changed May 01, 2011 12:21AM UTC by timmywil comment:14

owner: → timmywil
priority: majorhigh
status: openassigned

Dan's, John's, and my test cases all pass in IE9 so I don't think this is a problem in IE9, but it is a problem for IE6/7. Any attribute with a colon on a table element throws an "Invalid Argument" exception. I've created another test case as well. Working on a possible fix.

Changed May 01, 2011 09:20PM UTC by timmywil comment:15

resolution: → fixed
status: assignedclosed

Test for a colon in attribute names for IE6/7. Fixes #1591.

Changeset: 24a8ffb3eae56345231931184891f25f6ce017cf

Changed May 01, 2011 09:39PM UTC by timmywil comment:16

milestone: 1.next1.6

Changed May 03, 2011 01:06PM UTC by john comment:17

component: coreattributes