Skip to main content

Bug Tracker

Side navigation

#7710 closed bug (invalid)

Opened December 06, 2010 11:21AM UTC

Closed December 06, 2010 11:36AM UTC

find with argument false doesn't work

Reported by: gilles86@gmail.com 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'"

Attachments (0)
Change History (1)

Changed December 06, 2010 11:36AM UTC by jitter comment:1

_comment0: Thanks for taking the time to contribute to the jQuery project by writing a bug report. \ \ I checked your report and made a [http://jsfiddle.net/jitter/y9hfb/ live test case] out of it too. What you reported is not a bug in jQuery. Your usage of `find()` is completely invalid. The [http://api.jquery.com/find/ .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.1291635452901159
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.