MCPcopy Index your code
hub / github.com/angular/angular / _applyStateDiff

Method _applyStateDiff

packages/common/src/directives/ng_class.ts:159–178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

157 }
158
159 private _applyStateDiff() {
160 for (const stateEntry of this.stateMap) {
161 const klass = stateEntry[0];
162 const state = stateEntry[1];
163
164 if (state.changed) {
165 this._toggleClass(klass, state.enabled);
166 state.changed = false;
167 } else if (!state.touched) {
168 // A class that was previously active got removed from the new collection of classes -
169 // remove from the DOM as well.
170 if (state.enabled) {
171 this._toggleClass(klass, false);
172 }
173 this.stateMap.delete(klass);
174 }
175
176 state.touched = false;
177 }
178 }
179
180 private _toggleClass(klass: string, enabled: boolean): void {
181 if (ngDevMode) {

Callers 1

ngDoCheckMethod · 0.95

Calls 2

_toggleClassMethod · 0.95
deleteMethod · 0.45

Tested by

no test coverage detected