Skip to main content

Bug Tracker

Side navigation

#6701 closed bug (invalid)

Opened June 21, 2010 08:38PM UTC

Closed June 22, 2010 01:32AM UTC

jQuery(HTMLElement, context) ignores context

Reported by: keith bentrup Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: Cc:
Blocked by: Blocking:

If you pass an html element reference, then context is ignored.

Suppose you have this html:

<div id="my-div">...</div>

and this div is the target of a click event.

var myDiv =;

$(myDiv, $('#possible-containing-div'));

can give a different result than

$('#my-div', $('#possible-containing-div');

It's because of this if statement:

Here's my use case that led to this discovery: (It failed b/c context was ignored.)

$(document.body).click(function (ev) {

if ($(,$('#container')).length) return;

// code to execute if target element was NOT in container


Attachments (0)
Change History (1)

Changed June 22, 2010 01:32AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

There is no signature of the form

jQuery(element, context)

So this is not a bug.

For help in solving jQuery programming issues, ask on the forum.