Skip to content
Snippets Groups Projects
Commit f6528ec8 authored by Angie Byron's avatar Angie Byron
Browse files

#572872 by cwgordon7: Fixed coding style problems in collapse.js.

parent 53b9e820
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
(function ($) {
/**
* Toggle the visibility of a fieldset using smooth animations
* Toggle the visibility of a fieldset using smooth animations.
*/
Drupal.toggleFieldset = function (fieldset) {
if ($(fieldset).is('.collapsed')) {
......@@ -20,7 +20,7 @@ Drupal.toggleFieldset = function (fieldset) {
$('div.action', fieldset).show();
},
step: function () {
// Scroll the fieldset into view
// Scroll the fieldset into view.
Drupal.collapseScrollIntoView(this.parentNode);
}
});
......@@ -45,7 +45,8 @@ Drupal.collapseScrollIntoView = function (node) {
if (posY + node.offsetHeight + fudge > h + offset) {
if (node.offsetHeight > h) {
window.scrollTo(0, posY);
} else {
}
else {
window.scrollTo(0, posY + node.offsetHeight - h + fudge);
}
}
......@@ -55,7 +56,7 @@ Drupal.behaviors.collapse = {
attach: function (context, settings) {
$('fieldset.collapsible > legend', context).once('collapse', function () {
var fieldset = $(this.parentNode);
// Expand if there are errors inside
// Expand if there are errors inside.
if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
fieldset.removeClass('collapsed');
}
......@@ -68,12 +69,12 @@ Drupal.behaviors.collapse = {
})
.trigger('summaryUpdated');
// Turn the legend into a clickable link and wrap the contents of the fieldset
// in a div for easier animation
// Turn the legend into a clickable link and wrap the contents of the
// fieldset in a div for easier animation.
var text = this.innerHTML;
$(this).empty().append($('<a href="#">' + text + '</a>').click(function () {
var fieldset = $(this).parents('fieldset:first')[0];
// Don't animate multiple times
// Don't animate multiple times.
if (!fieldset.animating) {
fieldset.animating = true;
Drupal.toggleFieldset(fieldset);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment