Side navigation
#12775 closed bug (notabug)
Opened October 22, 2012 01:12PM UTC
Closed October 22, 2012 01:59PM UTC
IE9 Has attribute selector returning element twice
Reported by: | luigi.grilli@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Using the has attribute selector on IE9 return the same item twice. You can see a jsfiddle reproducing this error here:
http://jsfiddle.net/gigi81/3Vzse/4/
On IE9 the alert popups twice while on chrome and firefox only once (as it was supposed to be).
Here is the code for reference to reproduce the bug:
var callCount = 0;
$(function () {
$('[data-myattribute]').each(function () {
alert('call ' + (++callCount).toString());
});
});
<form action="">
<div data-myattribute="test" />
</form>
Ok I found out that closing div tag is a non-void element must have an end tag. That's why I have the call twice.
You can close this bug as that was the problem and not jQuery.