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
- Bug: Fixes #82, UMD header causes crash with RequireJS.
- 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.
- Bug: Fixes #84, Improved performance of
:dirty
selector (thanks @ziykon). - Bug: Fixed performance issue with CKEditor helper when there are no helpers in any of the forms on the page.
- 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. - 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
orignoreSelector
than it is to attach an event to an anchor tag that was excluded.