Ran this test page in FireFox 2.0.0.1:
<head>
<title>Test</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
(function($) {
$.fn.test = function(){
return this.each(function(){
var g = $('a', this);
$(g).click(function(){
var i = $(g).index($(this)[0]);
alert(i+' '+g.length);
return false;
});
});
};
})(jQuery);
$(function(){
$('div#mydiv').test();
});
</script>
</head>
<body>
<div id="mydiv">
http://www.google.com Google
http://www.msn.com MSN
http://www.yahoo.com Yahoo
</div>
</body>
Clicked on MSN and got expected result: '1 3' (index, length)
I added ' BEFORE '<div id="mydiv">' and ran test again.
<div id="mydiv">
http://www.google.com Google
http://www.msn.com MSN
http://www.yahoo.com Yahoo
</div>
Clicked on MSN and got: '2 4'
IE7 returned expected result of '1 3' in both cases. Is this a bug or am I
FUed?
--
View this message in context:
http://www.nabble.com/FireFox-and--%24%28-expr%2C-context-%29-tf3208028.html#a8908532
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/