* @param {!Element} container
(container)
| 205 | * @param {!Element} container |
| 206 | */ |
| 207 | unregisterContainer(container) { |
| 208 | const index = findObserverByContainer(this.observers_, container); |
| 209 | if (index < CUSTOM_CONTAINER_OFFSET) { |
| 210 | // The container has been unregistered already. |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | // Remove observer. |
| 215 | const observer = this.observers_[index]; |
| 216 | this.observers_.splice(index, 1); |
| 217 | if (observer.io) { |
| 218 | observer.io.disconnect(); |
| 219 | } |
| 220 | |
| 221 | // Unobserve the container itself. |
| 222 | this.unobserve(container, this.containerObserved_); |
| 223 | |
| 224 | // Remove observations. |
| 225 | this.targetObserverCallbacks_.forEach((callbacks, target) => { |
| 226 | const observations = this.targetObservations_.get(target); |
| 227 | if (!observations || observations.length <= index) { |
| 228 | return; |
| 229 | } |
| 230 | const oldDisplay = computeDisplay(observations, this.isDocDisplay_); |
| 231 | observations.splice(index, 1); |
| 232 | const newDisplay = computeDisplay(observations, this.isDocDisplay_); |
| 233 | notifyIfChanged(callbacks, target, newDisplay, oldDisplay); |
| 234 | }); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * @param {!Element} target |
no test coverage detected