Potential Bug with next()
I sent this to the wrong group earlier, sorry for what appears to be a double post.
Please see the sample code below. Running it in FF and checking the console should give you the error I am seeing. I know the code is pretty weird - it is simply an experiment. But when I warp a retrieved Comment node (using contents) and do .next() it seems to skip the actual sibling it should get. Is this a bug?
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$.annotated = function(filter, root){
if(filter){
filter = (filter.constructor == String)?[filter]:filter;
}
var annotations = $(root || document).find('*').andSelf().contents(
"[nodeType=8][nodeValue^=@]"
);
var annotated = annotations.map(
function(){
var target = $(this).next();
console.log(".next() ==" , target)
console.log("but nextSibling ==", this.nextSibling)
return target;
}
);
return $( $.unique(annotated.get()) );
}
$(function(){
$.annotated()
});
</script>
</head>
<body id="body">
<form id="frm1">
<input id="text001" type="text" /><br/>
<!--@Constraints({mandatory:true})--><input id="text002" type="text"/><br/>
</form>
</body>
</html>
------------------------------------------------------------------------------
This e-mail is intended solely for the addressee and is strictly confidential; if you are not the addressee please destroy the message and all copies. Any opinion or information contained in this email or its attachments that does not relate to the business of Kainos
is personal to the sender and is not given by or endorsed by Kainos. Kainos is the trading name of Kainos Software Limited, registered in Northern Ireland under company number: NI19370, having its registered offices at: Kainos House, 4-6 Upper Crescent, Belfast, BT7 1NT,
Northern Ireland. Registered in the UK for VAT under number: 454598802 and registered in Ireland for VAT under number: 9950340E. This email has been scanned for all known viruses by MessageLabs but is not guaranteed to be virus free; further terms and conditions may be
found on our website - www.kainos.com