Skip to content

Releases: snikch/jquery.dirtyforms

2.0.0

30 Jan 12:40
Compare
Choose a tag to compare

Important - Breaking Changes from Version 1.x

Please review the breaking changes in 2.0.0-beta00003 and 2.0.0-beta00005. Although much of the API is similar, due to the new state management behavior changes of Dirty Forms, it is unlikely your current code will work as is. Please review the documentation and test thoroughly if upgrading from 1.x.

Change Log

  1. Added documentation about Setting a Form Dirty Manually, since this is a frequent question (#93, #89, #79).

2.0.0-beta00008

30 Jan 08:30
Compare
Choose a tag to compare
2.0.0-beta00008 Pre-release
Pre-release

Change Log

  1. Enhancement: Added support for NPM to PNotify dialog module.
  2. Bug: Fixed PNotify dialog module so it is compatible with PNotify 3.x.

2.0.0-beta00006

15 Oct 17:23
Compare
Choose a tag to compare
2.0.0-beta00006 Pre-release
Pre-release

Change Log

  1. Bug: Fixes #87, Typo in Bootstrap dialog module - "messsageClass" property should be "messageClass".

2.0.0-beta00005

21 Sep 19:28
Compare
Choose a tag to compare
2.0.0-beta00005 Pre-release
Pre-release

Breaking Change - Anchor Tags without HREF no longer ignored by default

Ignoring anchor tags without HREF tags was a feature added before the release of 1.0.0. Before that, these anchors were not ignored. However, since it is much more difficult to attach events to anchors without HREF tags than it is to simply supply an ignoreSelector or add the ignoreClass to those elements you want to ignore (as per the following example), it is better to include them by default.

Attaching an Event Handler

$(document).bind('bind.dirtyforms', function (ev, events) {
    var originalBind = events.bind;

    events.bind = function (e) {
        $('#myTab li a').on('click', events.onAnchorClick);
        originalBind(e);
    };
});

Ignoring Anchor Tags

$('form').dirtyForms({ ignoreSelector: 'a.some-class:not([href])' });

Re-Ignoring Anchors without HREF

If you have been working with a version of Dirty Forms 1.0.0 to 2.0.0-beta00004, you can get back the same behavior by adding the following ignoreSelector on the first call to .dirtyForms.

$('form').dirtyForms({ ignoreSelector: 'a:not([href]),a:not([href]) >' });

Alternatively, if .dirtyForms has already been called:

$.DirtyForms.ignoreSelector = 'a:not([href]),a:not([href]) >';

Change Log

  1. Bug: Fixes #82, UMD header causes crash with RequireJS.
  2. Enhancement: In conjunction with the fix for #82, removed UMD support from all distribution sources except for NPM. This is the same thing that jQuery did, so we are following their lead.
  3. Bug: Fixes #84, Improved performance of :dirty selector (thanks @ziykon).
  4. Bug: Fixed performance issue with CKEditor helper when there are no helpers in any of the forms on the page.
  5. Enhancement: Improved performance of isDirty method by looping through all selected elements and returning immediately when the first dirty field is found. This on average results in about a 10x increase in performance.
  6. Enhancement: Reverted #59 in favor of #55 because some users complained about Dirty Forms not functioning with PJax and Bootstrap tabs. This is because by default anchors with no HREF are ignored. It is far easier to add an ignoreClass or ignoreSelector than it is to attach an event to an anchor tag that was excluded.

2.0.0-beta00004

02 Sep 12:31
Compare
Choose a tag to compare
2.0.0-beta00004 Pre-release
Pre-release

Change Log

  1. Bug: Fixes #80, reset form not functioning when reset event fired on the form.
  2. Enhancement: Reduced the amount of code necessary to check for legacy IE browsers to determine which events to attach.
  3. Documentation: Various documentation corrections/clarifications (see commit log for complete list).

2.0.0-beta00003

27 Jul 23:30
Compare
Choose a tag to compare
2.0.0-beta00003 Pre-release
Pre-release

Dirty Forms 2.0 BETA is Here!

What's New

  1. Advanced state management - if a user undoes their edits to a form, it is considered clean.
  2. New dirty.dirtyforms and clean.dirtyforms events to enable/disable the submit button when the form is dirty or clean.
  3. The default dialog has been changed to be the browser dialog, not Facebox. The default dialog configuration was so confusing it caused some people to write their own plugin (hope it was worth it!).
  4. Simpler dialog configuration - just implementing the dialog.open method is all that is required and events can be bound using a jQuery selector.
  5. New pre-fabricated dialog packages for BlockUI, Bootstrap Modal, Facebox, jQuery UI, and PNotify (complete with legacy support for Dirty Forms version < 2.0).
  6. More consistent (and shorter) method and event names.
  7. Customizable event binding (useful for working with IFrames).
  8. Better documentation and examples.

Breaking Changes

If upgrading from previous versions of Dirty Forms, there are several breaking changes to be mindful of.

  1. $.DirtyForms.onFormCheck() has been removed. Use the dirty.dirtyforms and clean.dirtyforms events for similar functionality.
  2. Facebox is no longer the default dialog. But if you need it, you can install the Facebox dialog module (a separate plugin).
  3. Support for the deprecated helper.isNodeDirty() has been removed.
  4. Support for the deprecated .setDirty(), .isDirty(), and .cleanDirty() jQuery methods has been removed.
  5. Automatic binding for top IFrames has been removed. This covered only 1 use case of many desired ways to configure IFrame support including event binding and target IFrame for refiring the event. You can now customize the event binding to get the desired result.
  6. Support for the deprecated $.DirtyForms.disable() function has been removed. Use $('html').addClass($.DirtyForms.ignoreClass) instead.
  7. The state behavior has been changed to store the initial state of each form input and to use this value to determine whether the input is dirty or clean. Editing an input back to its original state will automatically revert back to a clean state.
  8. The .dirtyForms('setDirty') method has been removed. This method doesn't fit with the new state management model. Use the helper.isDirty() method to provide dirty/clean status to Dirty Forms instead.
  9. The default setting for $.DirtyForms.ignoreClass has been changed from ignoredirty to dirtyignore for consistency with the other classes.
  10. The $.DirtyForms.isDirty() method has been removed. Use $('selector').dirtyForms('isDirty') instead.
  11. The beforeRefire.dirtyforms event has been removed (duplicate functionality). Use the proceed.dirtyforms event instead.
  12. The choicecommit.dirtyforms and choicecommitAfter.dirtyforms events have been removed. You can get similar behavior of choicecommit.dirtyforms by binding both the proceed.dirtyforms and stay.dirtyforms events. Also, you can get the same behavior of choiceCommitAfter.dirtyforms event by binding to the afterstay.dirtyforms event.
  13. The decidingcontinued.dirtyforms event has been renamed to proceed.dirtyforms.
  14. The decidingcancelled.dirtyforms event has been renamed to stay.dirtyforms.
  15. The decidingcancelledAfter.dirtyforms event has been renamed to afterstay.dirtyforms.
  16. The $.DirtyForms.title property has been moved to be an optional part of each dialog module rather than a part of the core module. It can be set at $.DirtyForms.dialog.title = 'The title' or .dirtyForms({ dialog: { title: 'The title' } }).
  17. The public method $.DirtyForms.isDeciding() has been removed. It is now safe to call choice.commit(event) (within the dialog.open() method) multiple times, so accessing it publicly is no longer necessary.
  18. The public method $.DirtyForms.decidingContinue() has been removed. You can either use the choice.proceedSelector to bind click events automatically, or set choice.proceed = true followed by a call to choice.commit(event) within the dialog.open() method.
  19. The public method $.DirtyForms.decidingCancel() has been removed. You can either use the choice.staySelector to bind click events automatically, or call choice.commit(event) (with choice.proceed set to the default of false).
  20. The public method $.DirtyForms.choiceCommit() and $.DirtyForms.choiceContinue property have been removed. Use choice.commit(event) and choice.proceed within the dialog.open() method instead.
  21. The dialog.fire(message, title) method has been renamed and signature changed to dialog.open(choice, message, ignoreClass). Now it is possible to use custom dialogs without any calls to the public $.DirtyForms object.
  22. Support for dialog.bind() has been removed. Bind dialog events in the dialog.open() method after the dialog has been added to the DOM instead. Note that you can now optionally use jQuery selectors for binding click events.
  23. The dialog.refire(content, event) method has been renamed and signature changed to dialog.unstash(stash, event). The stash is now a user-defined variable that can be any JavaScript type including jQuery object or JavaScript object.
  24. The dialog.selector property has been renamed to dialog.stashSelector to indicate that it is related to stashing. This should still be the selector of a form or parent container of a form that is hosted inside of another dialog.

1.2.3

17 Jul 20:13
Compare
Choose a tag to compare

Change Log

  1. Enhancement: Changed header declaration so the window and document object can be passed in, and use ECMAScript 5's strict mode.
  2. Enhancement: Reworked jQuery .on() method patch for jQuery < 1.7 so it is more concise.
  3. Bug: Fixed broken stashing support in the default Facebox dialog. The dialog was closing immediately upon restoring from the stash.
  4. Bug: Fixed missing </p> closing tag in the default Facebox dialog.
  5. Bug: Use event.which instead of event.keyCode, since which has been patched in jQuery to work in any browser.
  6. Bug: Patch for #49 (commit 26fdfec) caused the beforeunload.dirtyforms event to fire twice when continuing from the dialog.
  7. Bug: Performance was less than optimal when checking the dirty status because the logic was not set up correctly to exit from unnecessary looping after finding a dirty node.

1.2.2

08 Jul 09:01
Compare
Choose a tag to compare

Change Log

  1. Bug: Reverted change from c643809 because it is possible to nest elements within an anchor tag and the change broke support for it.

1.2.1

30 Jun 04:33
Compare
Choose a tag to compare

Change Log

  1. Bug: Reverted change in commit f3cd8a6 because it broke support for jQuery < 1.6. The .is() method didn't have an overload that accepted a jQuery object until then. If you are using jQuery 1.6+, you don't necessarily need this patch.

1.2.0

28 Jun 16:43
Compare
Choose a tag to compare

Change Log

  1. Bug: Reverted #66 because it is redundant to check for HREF here, duplicate of #59.
  2. Bug: Reverted #55 because it is redundant to check for HREF here, duplicate of #59.
  3. Bug: Fixed broken UMD support - plugin was using the jQuery object directly.
  4. Enhancement: Removed various blocks of redundant and overly verbose code, both to make it easier to maintain and to reduce the number of bytes in the download.
  5. Bug: Fixes #73 autofocused element not being marked dirty when changed.
  6. Enhancement: Made the bind, stash, refire, and selector members optional for dialogs. This will make them easier to implement.
  7. Feature: Closes #77, added support for ignoring child elements of containers (such as <div> and <form> elements).
  8. Bug: Fixes #45, escape key causing the beforeunload event to unregister with the default Facebox dialog. Added the fix (to capture the escape key, cancel the event, and call $.DirtyForms.choiceCancel()) to the documentation, since it applies to all dialogs.
  9. Enhancement: Changed the build script to remove the logging code (debug feature) from the minified JavaScript to remove some 1300 bytes from the file. Logging is still available in the uncompressed file.
  10. Bug: Clicking on a blank target was causing the onbeforeunload event to unregister.
  11. Enhancement: Reformatted the readme to make it easier to visually parse.