Merge branch 'master' of git://github.com/jquery/jquery into 2773_find_closest

This commit is contained in:
timmywil 2011-03-30 21:52:09 -04:00
commit 6da3885cc3
12 changed files with 188 additions and 35 deletions

View file

@ -0,0 +1,30 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>bug_8316</title>
<style type="text/css" media="screen">
#elem {
background-color: #000;
height: 100px;
width: 100px;
position: fixed;
}
</style>
<script src="../../../src/core.js"></script>
<script src="../../../src/deferred.js"></script>
<script src="../../../src/support.js"></script>
<script src="../../../src/sizzle/sizzle.js"></script>
<script src="../../../src/sizzle-jquery.js"></script>
<script src="../../../src/traversing.js"></script>
<script src="../../../src/data.js"></script>
<script src="../../../src/event.js"></script>
<script src="../../../src/css.js"></script>
<script src="../../../src/offset.js"></script>
</head>
<body>
<p> Some foo text </p>
<div id="elem"></div>
</body>
</html>

View file

@ -333,3 +333,15 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
ok( result, "elem.runtimeStyle does not throw exception" );
});
test("marginRight computed style (bug #3333)", function() {
expect(1);
var $div = jQuery("#foo");
$div.css({
width: "1px",
marginRight: 0
});
equals($div.css("marginRight"), "0px");
});

View file

@ -683,6 +683,20 @@ test("hover()", function() {
equals( times, 4, "hover handlers fired" );
});
test("mouseover triggers mouseenter", function() {
expect(1);
var count = 0,
elem = jQuery("<a />");
elem.mouseenter(function () {
count++;
});
elem.trigger('mouseover');
equals(count, 1, "make sure mouseover triggers a mouseenter" );
elem.remove();
});
test("trigger() shortcuts", function() {
expect(6);
@ -1966,6 +1980,31 @@ test("window resize", function() {
ok( !jQuery._data(window, "__events__"), "Make sure all the events are gone." );
});
test("focusin bubbles", function() {
expect(4);
var input = jQuery( '<input type="text" />' ).prependTo( "body" ),
order = 0;
jQuery( "body" ).bind( "focusin.focusinBubblesTest", function(){
equals( 1, order++, "focusin on the body second" );
});
input.bind( "focusin.focusinBubblesTest", function(){
equals( 0, order++, "focusin on the element first" );
});
// DOM focus method
input[0].focus();
// jQuery trigger, which calls DOM focus
order = 0;
input[0].blur();
input.trigger( "focus" );
input.remove();
jQuery( "body" ).unbind( "focusin.focusinBubblesTest" );
});
/*
test("jQuery(function($) {})", function() {
stop();

View file

@ -422,6 +422,21 @@ test("offsetParent", function(){
equals( div[1], jQuery("#nothiddendiv")[0], "The div is the offsetParent." );
});
testoffset("bug_8316", function( jQuery ){
expect(2);
var tests = [
{ id:'#elem', top: 100, left: 100 }
];
jQuery.each(tests, function(){
var el = jQuery(this.id);
el.offset({ top: this.top, left: this.left});
equals(Math.round(el.offset().top), this.top);
equals(Math.round(el.offset().left), this.left);
});
});
function testoffset(name, fn) {
test(name, function() {
@ -447,7 +462,7 @@ function testoffset(name, fn) {
function loadFixture() {
var src = './data/offset/' + name + '.html?' + parseInt( Math.random()*1000, 10 ),
iframe = jQuery('<iframe />').css({
width: 500, height: 500, position: 'absolute', top: -600, left: -600, visiblity: 'hidden'
width: 500, height: 500, position: 'absolute', top: -600, left: -600, visibility: 'hidden'
}).appendTo('body')[0];
iframe.contentWindow.location = src;
return iframe;