88 isUndefined ,
99 isObjectEmpty ,
1010 isProxy ,
11+ hasAnimate ,
1112} from "../../shared/utils.js" ;
1213import {
1314 PRISTINE_CLASS ,
@@ -264,8 +265,14 @@ export class FormController {
264265 * state (ng-dirty class). This method will also propagate to parent forms.
265266 */
266267 $setDirty ( ) {
267- this . $$animate . removeClass ( this . $$element , PRISTINE_CLASS ) ;
268- this . $$animate . addClass ( this . $$element , DIRTY_CLASS ) ;
268+ if ( hasAnimate ( this . $$element ) ) {
269+ this . $$animate . removeClass ( this . $$element , PRISTINE_CLASS ) ;
270+ this . $$animate . addClass ( this . $$element , DIRTY_CLASS ) ;
271+ } else {
272+ // Fallback for non-animated environments
273+ this . $$element . classList . remove ( PRISTINE_CLASS ) ;
274+ this . $$element . classList . add ( DIRTY_CLASS ) ;
275+ }
269276 this . $dirty = true ;
270277 this . $pristine = false ;
271278 this . $$parentForm . $setDirty ( ) ;
@@ -284,11 +291,18 @@ export class FormController {
284291 * saving or resetting it.
285292 */
286293 $setPristine ( ) {
287- this . $$animate . setClass (
288- this . $$element ,
289- PRISTINE_CLASS ,
290- `${ DIRTY_CLASS } ${ SUBMITTED_CLASS } ` ,
291- ) ;
294+ if ( hasAnimate ( this . $$element ) ) {
295+ this . $$animate . setClass (
296+ this . $$element ,
297+ PRISTINE_CLASS ,
298+ `${ DIRTY_CLASS } ${ SUBMITTED_CLASS } ` ,
299+ ) ;
300+ } else {
301+ // Fallback for non-animated environments
302+ this . $$element . classList . remove ( DIRTY_CLASS , SUBMITTED_CLASS ) ;
303+ this . $$element . classList . add ( PRISTINE_CLASS ) ;
304+ }
305+
292306 this . $dirty = false ;
293307 this . $pristine = true ;
294308 this . $submitted = false ;
@@ -326,7 +340,11 @@ export class FormController {
326340 }
327341
328342 $$setSubmitted ( ) {
329- this . $$animate . addClass ( this . $$element , SUBMITTED_CLASS ) ;
343+ if ( hasAnimate ( this . $$element ) ) {
344+ this . $$animate . addClass ( this . $$element , SUBMITTED_CLASS ) ;
345+ } else {
346+ this . $$element . classList . add ( SUBMITTED_CLASS ) ;
347+ }
330348 this . $submitted = true ;
331349 this . $$controls . forEach ( ( control ) => {
332350 if ( control . $$setSubmitted ) {
0 commit comments