Skip to content
Permalink
Browse files

Merge branch 'master' into selectmenu

  • Loading branch information
fnagel committed May 24, 2013
2 parents 7e0737e + c19e7b3 commit cccb8c6e826b8140dd99f225a28cc6f725e86ced
@@ -11,34 +11,58 @@
<script src="../../ui/jquery.ui.sortable.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
body { min-width: 520px; }
.column { width: 170px; float: left; padding-bottom: 100px; }
.portlet { margin: 0 1em 1em 0; }
.portlet-header { margin: 0.3em; padding-bottom: 4px; padding-left: 0.2em; }
.portlet-header .ui-icon { float: right; }
.portlet-content { padding: 0.4em; }
.ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; height: 50px !important; }
.ui-sortable-placeholder * { visibility: hidden; }
body {
min-width: 520px;
}
.column {
width: 170px;
float: left;
padding-bottom: 100px;
}
.portlet {
margin: 0 1em 1em 0;
padding: 0.3em;
}
.portlet-header {
padding: 0.2em 0.3em;
margin-bottom: 0.5em;
position: relative;
}
.portlet-toggle {
position: absolute;
top: 50%;
right: 0;
margin-top: -8px;
}
.portlet-content {
padding: 0.4em;
}
.portlet-placeholder {
border: 1px dotted black;
margin: 0 1em 1em 0;
height: 50px;
}
</style>
<script>
$(function() {
$( ".column" ).sortable({
connectWith: ".column"
connectWith: ".column",
handle: ".portlet-header",
cancel: ".portlet-toggle",
placeholder: "portlet-placeholder ui-corner-all"
});

$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
$( ".portlet" )
.addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
.end()
.find( ".portlet-content" );
.prepend( "<span class='ui-icon ui-icon-minusthick portlet-toggle'></span>");

$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
$( ".portlet-toggle" ).click(function() {
var icon = $( this );
icon.toggleClass( "ui-icon-minusthick ui-icon-plusthick" );
icon.closest( ".portlet" ).find( ".portlet-content" ).toggle();
});

$( ".column" ).disableSelection();
});
</script>
</head>
@@ -313,7 +313,7 @@ $.extend( $.simulate.prototype, {
clientY: Math.round( y )
};

this.simulateEvent( document, "mousemove", coord );
this.simulateEvent( target.ownerDocument, "mousemove", coord );
}

if ( $.contains( document, target ) ) {
@@ -169,4 +169,20 @@ test( "#5009: scroll not working with parent's position fixed", function() {
});
});

test( "#5727: draggable from iframe" , function() {
expect( 2 );

var iframe = $( "<iframe id='iframe-draggable-container' src='about:blank'></iframe>" ).appendTo( "#qunit-fixture" ),
iframeBody = iframe.contents().find( "body" ).append(
"<div id='iframe-draggable-1' style='background: green; width: 200px; height: 100px;'>Relative</div>"
),
draggable1 = iframeBody.find( "#iframe-draggable-1" );

draggable1.draggable();

equal( draggable1.closest( iframeBody ).length, 1 );

TestHelpers.draggable.shouldMove( draggable1 );
});

})( jQuery );
@@ -88,4 +88,33 @@ test( "disable", function() {
equal( actual, expected, "disable is chainable" );
});

})(jQuery);
test( "intersect", function() {
expect( 8 );

var actual, data,
draggable = $( "<div />" ).appendTo( "#qunit-fixture" ).css({ width: 10, height: 10, position: "absolute" }).draggable(),
droppable = $( "<div />" ).appendTo( "#qunit-fixture" ).css({ width: 10, height: 10, position: "absolute", top: 5, left: 5 }).droppable(),
dataset = [
[ -1, -1, false, "too far up and left" ],
[ -1, 0, false, "too far left" ],
[ 0, -1, false, "too far up" ],
[ 0, 0, true, "top left corner" ],
[ 9, 9, true, "bottom right corner" ],
[ 10, 9, false, "too far right" ],
[ 9, 10, false, "too far down" ],
[ 10, 10, false, "too far down and right" ]
],
x = 0;

for ( ; x < dataset.length; x++ ) {
data = dataset[ x ];
$( draggable ).simulate( "drag", {
dx: ( data[ 0 ] - $( draggable ).position().left ),
dy: ( data[ 1 ] - $( draggable ).position().top )
});
actual = $.ui.intersect( $( draggable ).draggable( "instance" ), $( droppable ).droppable( "instance" ), "pointer" );
equal( actual, data[ 2 ], data[ 3 ] );
}
});

})( jQuery );
@@ -331,6 +331,16 @@ test( "re-init", function() {
deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
});

test( "redeclare", function() {
expect( 2 );

$.widget( "ui.testWidget", {} );
equal( $.ui.testWidget.prototype.widgetEventPrefix, "testWidget" );

$.widget( "ui.testWidget", {} );
equal( $.ui.testWidget.prototype.widgetEventPrefix, "testWidget" );
});

test( "inheritance", function() {
expect( 6 );
// #5830 - Widget: Using inheritance overwrites the base classes options
@@ -6,13 +6,13 @@ jQuery(function($){
prevText: '&#x3C;Ant',
nextText: 'Sig&#x3E;',
currentText: 'Hoy',
monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun',
'Jul','Ago','Sep','Oct','Nov','Dic'],
dayNames: ['Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sábado'],
dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi',''],
monthNames: ['enero','febrero','marzo','abril','mayo','junio',
'julio','agosto','septiembre','octubre','noviembre','diciembre'],
monthNamesShort: ['ene','feb','mar','abr','may','jun',
'jul','ogo','sep','oct','nov','dic'],
dayNames: ['domingo','lunes','martes','miércoles','jueves','viernes','sábado'],
dayNamesShort: ['dom','lun','mar','mié','juv','vie','sáb'],
dayNamesMin: ['D','L','M','X','J','V','S'],
weekHeader: 'Sm',
dateFormat: 'dd/mm/yy',
firstDay: 1,
@@ -6,13 +6,13 @@ jQuery(function($){
prevText: '&#x3C;Préc',
nextText: 'Suiv&#x3E;',
currentText: 'Courant',
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
'Jul','Aoû','Sep','Oct','Nov','Déc'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
monthNames: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin',
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
monthNamesShort: ['janv.', 'févr.', 'mars', 'avril', 'mai', 'juin',
'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
dayNames: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
dayNamesShort: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
dayNamesMin: ['D', 'L', 'M', 'M', 'J', 'V', 'S'],
weekHeader: 'Sm',
dateFormat: 'dd.mm.yy',
firstDay: 1,
@@ -8,12 +8,12 @@ jQuery(function($){
prevText: 'Précédent',
nextText: 'Suivant',
currentText: 'Aujourd\'hui',
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
monthNames: ['janvier', 'février', 'mars', 'avril', 'mai', 'juin',
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
monthNamesShort: ['janv.', 'févr.', 'mars', 'avril', 'mai', 'juin',
'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.'],
dayNames: ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'],
dayNamesShort: ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.'],
dayNamesMin: ['D','L','M','M','J','V','S'],
weekHeader: 'Sem.',
dateFormat: 'dd/mm/yy',
@@ -69,7 +69,7 @@ $.fn.extend({
}).eq(0);
}

return (/fixed/).test(this.css("position")) || !scrollParent.length ? $(document) : scrollParent;
return ( /fixed/ ).test( this.css( "position") ) || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent;
},

uniqueId: function() {
@@ -342,7 +342,10 @@ $.widget( "ui.dialog", {
}
});

this.uiDialogTitlebarClose = $("<button></button>")
// support: IE
// Use type="button" to prevent enter keypresses in textboxes from closing the
// dialog in IE (#9312)
this.uiDialogTitlebarClose = $( "<button type='button'></button>" )
.button({
label: this.options.closeText,
icons: {
@@ -325,7 +325,8 @@ $.widget("ui.draggable", $.ui.mouse, {
_getParentOffset: function() {

//Get the offsetParent and cache its position
var po = this.offsetParent.offset();
var po = this.offsetParent.offset(),
document = this.document[ 0 ];

// This is a special case where we need to modify a offset calculated on start, since the following happened:
// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
@@ -383,7 +384,8 @@ $.widget("ui.draggable", $.ui.mouse, {
_setContainment: function() {

var over, c, ce,
o = this.options;
o = this.options,
document = this.document[ 0 ];

if ( !o.containment ) {
this.containment = null;
@@ -444,6 +446,7 @@ $.widget("ui.draggable", $.ui.mouse, {
}

var mod = d === "absolute" ? 1 : -1,
document = this.document[ 0 ],
scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent;

//Cache the scroll
@@ -472,6 +475,7 @@ $.widget("ui.draggable", $.ui.mouse, {

var containment, co, top, left,
o = this.options,
document = this.document[ 0 ],
scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
pageX = event.pageX,
pageY = event.pageY;
@@ -778,17 +782,17 @@ $.ui.plugin.add("draggable", "opacity", {

$.ui.plugin.add("draggable", "scroll", {
start: function( event, ui, i ) {
if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
if( i.scrollParent[ 0 ] !== i.document[ 0 ] && i.scrollParent[ 0 ].tagName !== "HTML" ) {
i.overflowOffset = i.scrollParent.offset();
}
},
drag: function( event, ui, i ) {

var o = i.options,
scrolled = false;

if(i.scrollParent[0] !== document && i.scrollParent[0].tagName !== "HTML") {
scrolled = false,
document = i.document[ 0 ];

if( i.scrollParent[ 0 ] !== document && i.scrollParent[ 0 ].tagName !== "HTML" ) {
if(!o.axis || o.axis !== "x") {
if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) {
i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
@@ -17,7 +17,7 @@
(function( $, undefined ) {

function isOverAxis( x, reference, size ) {
return ( x > reference ) && ( x < ( reference + size ) );
return ( x >= reference ) && ( x < ( reference + size ) );
}

$.widget("ui.droppable", {
@@ -48,7 +48,7 @@ $.widget("ui.mouse", {
_mouseDestroy: function() {
this.element.unbind("."+this.widgetName);
if ( this._mouseMoveDelegate ) {
$(document)
this.document
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
}
@@ -99,9 +99,10 @@ $.widget("ui.mouse", {
this._mouseUpDelegate = function(event) {
return that._mouseUp(event);
};
$(document)
.bind("mousemove."+this.widgetName, this._mouseMoveDelegate)
.bind("mouseup."+this.widgetName, this._mouseUpDelegate);

this.document
.bind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.bind( "mouseup." + this.widgetName, this._mouseUpDelegate );

event.preventDefault();

@@ -114,6 +115,10 @@ $.widget("ui.mouse", {
if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) {
return this._mouseUp(event);
}
// Iframe mouseup check - mouseup occurred in another document
else if ( !event.which ) {
return this._mouseUp( event );
}

if (this._mouseStarted) {
this._mouseDrag(event);
@@ -130,9 +135,9 @@ $.widget("ui.mouse", {
},

_mouseUp: function(event) {
$(document)
.unbind("mousemove."+this.widgetName, this._mouseMoveDelegate)
.unbind("mouseup."+this.widgetName, this._mouseUpDelegate);
this.document
.unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate )
.unbind( "mouseup." + this.widgetName, this._mouseUpDelegate );

if (this._mouseStarted) {
this._mouseStarted = false;
@@ -144,6 +149,7 @@ $.widget("ui.mouse", {
this._mouseStop(event);
}

mouseHandled = false;
return false;
},

@@ -70,7 +70,7 @@ $.position = {
return cachedScrollbarWidth;
}
var w1, w2,
div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
div = $( "<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
innerDiv = div.children()[0];

$( "body" ).append( div );
@@ -16,7 +16,7 @@
(function( $, undefined ) {

function isOverAxis( x, reference, size ) {
return ( x > reference ) && ( x < ( reference + size ) );
return ( x >= reference ) && ( x < ( reference + size ) );
}

function isFloating(item) {
@@ -22,6 +22,10 @@ function getNextTabId() {
}

function isLocal( anchor ) {
// support: IE7
// IE7 doesn't normalize the href property when set via script (#9317)
anchor = anchor.cloneNode( false );

return anchor.hash.length > 1 &&
decodeURIComponent( anchor.href.replace( rhash, "" ) ) ===
decodeURIComponent( location.href.replace( rhash, "" ) );

0 comments on commit cccb8c6

Please sign in to comment.
You can’t perform that action at this time.