From 6db96bfb8f07ef35282b329d6a0a09b5aa69726f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20Mo=C3=9Fhammer?= Date: Mon, 2 Sep 2013 10:25:21 +0200 Subject: [PATCH] CS Fixes: form.js License, comments and deprecated bind() refs #4622 --- public/js/icinga/components/form.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/public/js/icinga/components/form.js b/public/js/icinga/components/form.js index 323088061..1ca43eeca 100644 --- a/public/js/icinga/components/form.js +++ b/public/js/icinga/components/form.js @@ -1,6 +1,9 @@ /*global Icinga:false define:false require:false base_url:false console:false */ -// {{{ICINGA_LICENSE_HEADER}}} -// {{{ICINGA_LICENSE_HEADER}}} +/** + * {{LICENSE_HEADER}} + * {{LICENSE_HEADER}} + */ + /** * Icinga app/form component. @@ -22,9 +25,9 @@ define(['jquery'], function($) { /** * Return true when the input element is a autosubmit field * - * @param {string|DOMElement|jQuery} el The element to test for autosubmission + * @param {string|DOMElement|jQuery} el The element to test for autosubmission * - * @returns {boolean} True when the element should be automatically submitted + * @returns {boolean} True when the element should be automatically submitted */ var isAutoSubmitInput = function(el) { return $(el).attr('data-icinga-form-autosubmit') === 'true' || @@ -34,14 +37,14 @@ define(['jquery'], function($) { /** * Takes a form and returns an overloaded jQuery object * - * The returned object is the jQuery mathcer with the following additional methods: + * The returned object is the jQuery matcher with the following additional methods: * - * - isModified : Return true when the form is marked as modified - * - setModificationFlag : Mark this form as being modified - * - clearModificationFlag : Clear the modification mark + * - isModified: Return true when the form is marked as modified + * - setModificationFlag: Mark this form as being modified + * - clearModificationFlag: Clear the modification mark * * @param targetForm - * @returns {JQuery} + * @returns {jQuery} */ var getFormObject = function(targetForm) { var form = $(targetForm); @@ -100,7 +103,7 @@ define(['jquery'], function($) { */ var registerLeaveConfirmationHandler = function(form) { - $(window).bind('beforeunload', function() { + $(window).on('beforeunload', function() { if (form.isModified()) { return 'All unsaved changes will be lost when leaving this page'; }