#332 ✓invalid
BillyRayPreachersSon

Element.select with LIs can return incorrect elements using Prototype 1.6.0.2 under Opera 9.52

Reported by BillyRayPreachersSon | September 9th, 2008 @ 04:26 PM | in 1.7

Using most browsers (IE 6 & 7, Opera 9.00, 9.23 & 9.27, Firefox 2.0.0.16, and even Chrome), the following code will correctly find 3 nodes:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Opera 9.52 select test</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<script type="text/javascript" src="prototype.js"></script>
	<script type="text/javascript">

		window.onload = setup;

		function setup() {
			var theModule = $('theDiv');
			if (theModule) {
				var theItems = theModule.select('li a');
				alert('Found ' + theItems.length + ' items');
			}
		}
	</script>
</head>

<body>
	<div id="theDiv">
		<ul>
			<li><a href="#">An item</a></li>
			<li><a href="#">An item</a></li>
		</ul>
		<ul>
			<li><a href="#">An item</a></li>
		</ul>
	</div>
</body>
</html>

You can also find this code here: http://www.soterm.com/prototypej...

However, in Opera 9.52 (and possibly other 9.5x versions), it only finds the anchors in the first UL, alerting only "2".

If I change the select statement to look for 'ul a' or even just 'a', it will find all 3, but not if I have the LI rule as well.

I'm using Prototype 1.6.0.2, but haven't tried this with 1.6.0.3.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

Pages