Opened 12 years ago
Closed 10 years ago
#9795 closed bug (fixed)
IE7,8 Has Attribute Selector for Colspan in TD and TH Tags
Reported by: | adamterlson | Owned by: | mikesherov |
---|---|---|---|
Priority: | low | Milestone: | 1.8 |
Component: | attributes | Version: | 1.6.2 |
Keywords: | ie7 ie8 | Cc: | |
Blocked by: | Blocking: |
Description
In all versions of jQuery, including the latest (1.6.2), in both IE7 and IE8, a has-attribute selector will return false positives for all TH tags when testing for the colspan attribute.
Tested on Windows 7.
I submit this hoping something can be done about this, despite its roots likely being in the [flawed] browsers themselves.
Example HTML:
<table id="one"><tr><th>fred</th></tr></table> <table id="two"><tr><td>fred</td></tr></table>
Example JS:
alert($('#one').find('th[colspan!=""]').length); //Returns 1 alert($('#one').find('th[colspan]').length); //Returns 1 alert($('#two').find('td[colspan!=""]').length); //Returns 1 alert($('#two').find('td[colspan]').length); //Returns 1 $('#one').find('th').each(function() { alert('colspan:' + $(this).attr('colspan')); //Returns 1 in IE7,8 and "undefined" otherwise });
Clearly, given this code sample, this attribute should return 0 in IE7 and 8, as it does with IE9, FireFox, and Chrome.
In the last loop, you will see that I output the attribute of the colspan for the TH in the table. In IE7 and 8, a "1" is returned, meaning a colspan of "1". In IE9, and all non-IE browsers, "undefined" is the result as expected.
Thank you, and my apologies if this has been reported (I, however, could not find a duplicate).
Change History (5)
comment:1 Changed 12 years ago by
Component: | unfiled → attributes |
---|---|
Priority: | undecided → low |
Status: | new → open |
comment:2 Changed 11 years ago by
Keywords: | ie7 ie8 added |
---|
comment:3 Changed 10 years ago by
Milestone: | 1.next → 1.8 |
---|---|
Owner: | set to mikesherov |
Status: | open → assigned |
This was fixed in the Sizzle rewrite in 1.8. timmywil, do you have a test case covering this situation? If so, let me know so we can close this, otherwise, I can write a test for this.
comment:4 Changed 10 years ago by
We don't have tests for colspan specifically, but we do now have tests in Sizzle covering empty string values and in jQuery's selector tests covering attribute presence. I'm always happy to add more tests though.
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
If you already have equivalent tests here timmywil, I'm just closing this as fixed then.
Confirmed. Issue is in both attributes and selector modules.
Without alerts: http://jsfiddle.net/timmywil/GHXBH/7/