Skip to content

Commit cda560f

Browse files
committed
fix(gridster): resize_widget also accepts HTMLElements
for consistency with the `remove_widget`
1 parent 7de5bba commit cda560f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/jquery.gridster.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,17 @@
444444
* Change the size of a widget. Width is limited to the current grid width.
445445
*
446446
* @method resize_widget
447-
* @param {HTMLElement} $widget The jQuery wrapped HTMLElement
448-
* representing the widget.
447+
* * @param {HTMLElement|$HTMLElement} el The widget HTMLElement, jQuery
448+
* wrapped or not, you want to resize.
449449
* @param {Number} size_x The number of columns that will occupy the widget.
450450
* By default <code>size_x</code> is limited to the space available from
451451
* the column where the widget begins, until the last column to the right.
452452
* @param {Number} size_y The number of rows that will occupy the widget.
453453
* @param {Function} [callback] Function executed when the widget is removed.
454454
* @return {HTMLElement} Returns $widget.
455455
*/
456-
fn.resize_widget = function($widget, size_x, size_y, callback) {
456+
fn.resize_widget = function(el, size_x, size_y, callback) {
457+
var $widget = el instanceof $ ? el : $(el);
457458
var wgd = $widget.coords().grid;
458459
var col = wgd.col;
459460
var max_cols = this.options.max_cols;
@@ -719,7 +720,8 @@
719720
* Remove a widget from the grid.
720721
*
721722
* @method remove_widget
722-
* @param {HTMLElement} el The jQuery wrapped HTMLElement you want to remove.
723+
* @param {HTMLElement|$HTMLElement} el The widget HTMLElement, jQuery wrapped
724+
* or not, you want to remove.
723725
* @param {Boolean|Function} silent If true, widgets below the removed one
724726
* will not move up. If a Function is passed it will be used as callback.
725727
* @param {Function} callback Function executed when the widget is removed.

0 commit comments

Comments
 (0)