Skip to content

Commit d6cb8f7

Browse files
committed
WIP no html creation
1 parent 5787a75 commit d6cb8f7

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

ui/effect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ $.fn.extend( {
823823

824824
transfer: function( options, done ) {
825825
var element = $( this ),
826-
target = $( options.to ),
826+
target = $( document ).find( options.to ),
827827
targetFixed = target.css( "position" ) === "fixed",
828828
body = $( "body" ),
829829
fixTop = targetFixed ? body.scrollTop() : 0,

ui/widgets/draggable.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,9 @@ $.widget( "ui.draggable", $.ui.mouse, {
540540
o.containment = this.helper[ 0 ].parentNode;
541541
}
542542

543-
c = $( o.containment );
543+
c = typeof o.containment === "string" ?
544+
$( document ).find( o.containment ) :
545+
$( o.containment );
544546
ce = c[ 0 ];
545547

546548
if ( !ce ) {

ui/widgets/resizable.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ $.widget( "ui.resizable", $.ui.mouse, {
369369
_mouseStart: function( event ) {
370370

371371
var curleft, curtop, cursor, calculatedSize,
372+
containmentElem,
372373
o = this.options,
373374
el = this.element;
374375

@@ -380,8 +381,11 @@ $.widget( "ui.resizable", $.ui.mouse, {
380381
curtop = this._num( this.helper.css( "top" ) );
381382

382383
if ( o.containment ) {
383-
curleft += $( o.containment ).scrollLeft() || 0;
384-
curtop += $( o.containment ).scrollTop() || 0;
384+
containmentElem = typeof o.containment === "string" ?
385+
$( document ).find( o.containment ) :
386+
$( o.containment );
387+
curleft += containmentElem.scrollLeft() || 0;
388+
curtop += containmentElem.scrollTop() || 0;
385389
}
386390

387391
this.offset = this.helper.offset();
@@ -1097,9 +1101,12 @@ $.ui.plugin.add( "resizable", "alsoResize", {
10971101

10981102
start: function() {
10991103
var that = $( this ).resizable( "instance" ),
1100-
o = that.options;
1104+
o = that.options,
1105+
alsoResize = typeof o.alsoResize === "string" ?
1106+
$( document ).find( o.alsoResize ) :
1107+
$( o.alsoResize );
11011108

1102-
$( o.alsoResize ).each( function() {
1109+
alsoResize.each( function() {
11031110
var el = $( this ),
11041111
elSize = that._calculateAdjustedElementDimensions( el );
11051112

ui/widgets/selectable.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ return $.widget( "ui.selectable", $.ui.mouse, {
6161
// Cache selectee children based on filter
6262
this.refresh = function() {
6363
that.elementPos = $( that.element[ 0 ] ).offset();
64-
that.selectees = $( that.options.filter, that.element[ 0 ] );
64+
that.selectees = $( that.element[ 0 ] ).find( that.options.filter );
6565
that._addClass( that.selectees, "ui-selectee" );
6666
that.selectees.each( function() {
6767
var $this = $( this ),
@@ -99,7 +99,10 @@ return $.widget( "ui.selectable", $.ui.mouse, {
9999

100100
_mouseStart: function( event ) {
101101
var that = this,
102-
options = this.options;
102+
options = this.options,
103+
appendTo = typeof options.appendTo === "string" ?
104+
$( document ).find( options.appendTo ) :
105+
$( options.appendTo );
103106

104107
this.opos = [ event.pageX, event.pageY ];
105108
this.elementPos = $( this.element[ 0 ] ).offset();
@@ -108,11 +111,11 @@ return $.widget( "ui.selectable", $.ui.mouse, {
108111
return;
109112
}
110113

111-
this.selectees = $( options.filter, this.element[ 0 ] );
114+
this.selectees = $( this.element[ 0 ] ).find( options.filter );
112115

113116
this._trigger( "start", event );
114117

115-
$( options.appendTo ).append( this.helper );
118+
appendTo.append( this.helper );
116119

117120
// position helper (lasso)
118121
this.helper.css( {

ui/widgets/sortable.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ return $.widget( "ui.sortable", $.ui.mouse, {
198198
this.refreshPositions();
199199

200200
//Prepare the dragged items parent
201-
this.appendTo = $( o.appendTo !== "parent" ?
202-
o.appendTo :
203-
this.currentItem.parent() );
201+
if ( o.appendTo === "parent" ) {
202+
this.appendTo = this.currentItem.parent();
203+
} else {
204+
this.appendTo = typeof o.appendTo === "string" ?
205+
$( document ).find( o.appendTo ) :
206+
$( o.appendTo );
207+
}
204208

205209
//Create and append the visible helper
206210
this.helper = this._createHelper( event );
@@ -1238,7 +1242,10 @@ return $.widget( "ui.sortable", $.ui.mouse, {
12381242
_setContainment: function() {
12391243

12401244
var ce, co, over,
1241-
o = this.options;
1245+
o = this.options,
1246+
containmentElem = typeof o.containment === "string" ?
1247+
$( document ).find( o.containment ) :
1248+
$( o.containment );
12421249
if ( o.containment === "parent" ) {
12431250
o.containment = this.helper[ 0 ].parentNode;
12441251
}
@@ -1257,8 +1264,8 @@ return $.widget( "ui.sortable", $.ui.mouse, {
12571264
}
12581265

12591266
if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) {
1260-
ce = $( o.containment )[ 0 ];
1261-
co = $( o.containment ).offset();
1267+
ce = containmentElem[ 0 ];
1268+
co = containmentElem.offset();
12621269
over = ( $( ce ).css( "overflow" ) !== "hidden" );
12631270

12641271
this.containment = [

0 commit comments

Comments
 (0)