Bug Tracker

Opened 9 years ago

Closed 9 years ago

#7710 closed bug (invalid)

find with argument false doesn't work

Reported by: gilles86@… Owned by:
Priority: undecided Milestone: 1.6
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

There is a bug in the newest version. here is a sample code so u know what happens:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Untitled Document</title>
		<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {
				$("#test").find(false);
				
			});
		</script>
	</head>
	<body>
		<ul id="test"></ul>
	</body>
</html>

It will try to use the replace function on false which is not possible. Tested in IE8, Chrome and Firefox. Always the same bug. "Uncaught TypeError: Object false has no method 'replace'"

Change History (1)

comment:1 Changed 9 years ago by jitter

Resolution: invalid
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

I checked your report and made a live test case out of it too. What you reported is not a bug in jQuery. Your usage of find() is completely invalid. The .find(selector) documentation says:

selector A string containing a selector expression to match elements against

false clearly is neither a string nor a valid selector thus you can't expect jQuery to do anything useful with an input like this one. The fact that jQuery didn't throw an error on this in earlier versions is purely coincidental. So this is a bug in your application logic which needs to get fixed.

Last edited 9 years ago by jitter (previous) (diff)
Note: See TracTickets for help on using tickets.