()
| 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) { |
no test coverage detected