-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Resizable: alsoResize more than one element of a jQuery selection #1324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,4 +404,34 @@ test( "alsoResize + containment", function() { | |
equal( other.height(), 150, "alsoResize constrained height at containment edge" ); | ||
}); | ||
|
||
test( "alsoResize + multiple selection", function() { | ||
expect( 6 ); | ||
var other1 = $( "<div>" ) | ||
.addClass("other") | ||
.css({ | ||
width: 50, | ||
height: 50 | ||
}) | ||
.appendTo( "body" ), | ||
other2 = $( "<div>" ) | ||
.addClass("other") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spacing |
||
.css({ | ||
width: 50, | ||
height: 50 | ||
}) | ||
.appendTo( "body"), | ||
element = $( "#resizable1" ).resizable({ | ||
alsoResize: $.merge(other1, other2), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
containment: "#container" | ||
}); | ||
|
||
TestHelpers.resizable.drag( ".ui-resizable-se", 400, 400 ); | ||
equal( element.width(), 300, "resizable constrained width at containment edge" ); | ||
equal( element.height(), 200, "resizable constrained height at containment edge" ); | ||
equal( other1.width(), 250, "alsoResize o1 constrained width at containment edge" ); | ||
equal( other1.height(), 150, "alsoResize o1 constrained height at containment edge" ); | ||
equal( other2.width(), 250, "alsoResize o2 constrained width at containment edge" ); | ||
equal( other2.height(), 150, "alsoResize o2 constrained height at containment edge" ); | ||
}); | ||
|
||
})(jQuery); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -994,19 +994,7 @@ $.ui.plugin.add("resizable", "alsoResize", { | |
}); | ||
}); | ||
}; | ||
|
||
if (typeof(o.alsoResize) === "object" && !o.alsoResize.parentNode) { | ||
if (o.alsoResize.length) { | ||
o.alsoResize = o.alsoResize[0]; | ||
_store(o.alsoResize); | ||
} else { | ||
$.each(o.alsoResize, function(exp) { | ||
_store(exp); | ||
}); | ||
} | ||
} else { | ||
_store(o.alsoResize); | ||
} | ||
_store(o.alsoResize); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can also be inlined instead of having a function now. |
||
}, | ||
|
||
resize: function(event, ui) { | ||
|
@@ -1040,14 +1028,7 @@ $.ui.plugin.add("resizable", "alsoResize", { | |
el.css(style); | ||
}); | ||
}; | ||
|
||
if (typeof(o.alsoResize) === "object" && !o.alsoResize.nodeType) { | ||
$.each(o.alsoResize, function(exp, c) { | ||
_alsoResize(exp, c); | ||
}); | ||
} else { | ||
_alsoResize(o.alsoResize); | ||
} | ||
_alsoResize(o.alsoResize); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The function call is no longer needed since there's a single path. Just do the looping directly. The logic inside the loop should also be cleaned up since there are no longer any contexts provided for the searching. |
||
}, | ||
|
||
stop: function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spacing