CS Fixes: form.js License, comments and deprecated bind()

refs #4622
This commit is contained in:
Jannis Moßhammer 2013-09-02 10:25:21 +02:00 committed by Marius Hein
parent c77f4ff1d9
commit 6db96bfb8f

View File

@ -1,6 +1,9 @@
/*global Icinga:false define:false require:false base_url:false console:false */ /*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. * Icinga app/form component.
@ -22,9 +25,9 @@ define(['jquery'], function($) {
/** /**
* Return true when the input element is a autosubmit field * 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) { var isAutoSubmitInput = function(el) {
return $(el).attr('data-icinga-form-autosubmit') === 'true' || return $(el).attr('data-icinga-form-autosubmit') === 'true' ||
@ -34,14 +37,14 @@ define(['jquery'], function($) {
/** /**
* Takes a form and returns an overloaded jQuery object * 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 * - isModified: Return true when the form is marked as modified
* - setModificationFlag : Mark this form as being modified * - setModificationFlag: Mark this form as being modified
* - clearModificationFlag : Clear the modification mark * - clearModificationFlag: Clear the modification mark
* *
* @param targetForm * @param targetForm
* @returns {JQuery} * @returns {jQuery}
*/ */
var getFormObject = function(targetForm) { var getFormObject = function(targetForm) {
var form = $(targetForm); var form = $(targetForm);
@ -100,7 +103,7 @@ define(['jquery'], function($) {
*/ */
var registerLeaveConfirmationHandler = function(form) { var registerLeaveConfirmationHandler = function(form) {
$(window).bind('beforeunload', function() { $(window).on('beforeunload', function() {
if (form.isModified()) { if (form.isModified()) {
return 'All unsaved changes will be lost when leaving this page'; return 'All unsaved changes will be lost when leaving this page';
} }