The .live() method is new in 1.3 and remove the need of livequery with
some enhancements. I wrote some tests for this specific behaviour and
I think it is a corner-case only for .live. Here is some code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=utf-8" />
<meta http-equiv="content-language" content="en-us" />
<title>.live - selector bug</title>
<link charset="utf-8" type="text/css" rel="stylesheet"
media="all" href="testrunner.css" />
<script charset="utf-8" type="text/javascript"
src="jquery.js"></script>
<script charset="utf-8" type="text/javascript"
src="testrunner.js"></script>
<script charset="utf-8" type="text/javascript">
$(function (){
test(".live selector bug", function() {
expect(3)
var divA = 0, divB = 0, divC = 0;
var parent = $("div#parent");
// work
$("div#child").live("click", function(){ divA+
+; });
// work
$("div#child", parent).live("click", function()
{ divB++ });
// don't work
$("div#parent div#child").live("click", function()
{ divC++; });
$("div#child").trigger("click");
// work
equals(divA, 1, 'calling .live with $("child")');
// work
equals(divB, 1, 'calling .live with $("child",
parentCache)');
// don't work
equals(divC, 1, 'calling .live with $("parent
child")');
});
});
</script>
</head>
<body id="body">
<h1 id="header">jQuery Test Suite</h1>
<h2 id="banner"></h2>
<h2 id="userAgent"></h2>
<!-- Test HTML -->
<div id="parent">
<div id="child">
</div>
</div>
<div id="main" style="display: none;">
</div>
<ol id="tests"></ol>
</body>
</html>
Living example with output: http://dev.somethinstupid.org/livebug/
The example use jQuery 1.3b2pre $Rev: 6010
alex
On Dec 30, 1:22 pm, Olaf <[email protected]> wrote:
> What is .live() i never see this function in core!?
> Come with a plugin?
On Dec 30, 1:22 pm, Olaf <[email protected]> wrote:
> What is .live() i never see this function in core!?
> Come with a plugin?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---