|
911 | 911 | $field = module.get.field(identifier),
|
912 | 912 | $fieldGroup = $field.closest($group),
|
913 | 913 | $prompt = $fieldGroup.children(selector.prompt),
|
914 |
| - promptExists = $prompt.length > 0 |
| 914 | + promptExists = $prompt.length > 0, |
| 915 | + canTransition = settings.transition && module.can.useElement('transition') |
915 | 916 | ;
|
916 | 917 | module.verbose('Adding field error state', identifier);
|
917 | 918 | if (!internal) {
|
|
920 | 921 | ;
|
921 | 922 | }
|
922 | 923 | if (settings.inline) {
|
| 924 | + if (promptExists) { |
| 925 | + if (canTransition) { |
| 926 | + if ($prompt.transition('is animating')) { |
| 927 | + $prompt.transition('stop all'); |
| 928 | + } |
| 929 | + } else if ($prompt.is(':animated')) { |
| 930 | + $prompt.stop(true, true); |
| 931 | + } |
| 932 | + $prompt = $fieldGroup.children(selector.prompt); |
| 933 | + promptExists = $prompt.length > 0; |
| 934 | + } |
923 | 935 | if (!promptExists) {
|
924 | 936 | $prompt = $('<div/>').addClass(className.label);
|
| 937 | + if (!canTransition) { |
| 938 | + $prompt.css('display', 'none'); |
| 939 | + } |
925 | 940 | $prompt
|
926 | 941 | .appendTo($fieldGroup)
|
927 | 942 | ;
|
|
930 | 945 | .html(settings.templates.prompt(errors))
|
931 | 946 | ;
|
932 | 947 | if (!promptExists) {
|
933 |
| - if (settings.transition && module.can.useElement('transition')) { |
| 948 | + if (canTransition) { |
934 | 949 | module.verbose('Displaying error with css transition', settings.transition);
|
935 | 950 | $prompt.transition(settings.transition + ' in', settings.duration);
|
936 | 951 | } else {
|
|
939 | 954 | .fadeIn(settings.duration)
|
940 | 955 | ;
|
941 | 956 | }
|
942 |
| - } else { |
943 |
| - module.verbose('Inline errors are disabled, no inline error added', identifier); |
944 | 957 | }
|
| 958 | + } else { |
| 959 | + module.verbose('Inline errors are disabled, no inline error added', identifier); |
945 | 960 | }
|
946 | 961 | },
|
947 | 962 | errors: function (errors) {
|
|
0 commit comments