( el: ElementWithTransition, root: Node, moveClass: string, )
| 235 | } |
| 236 | |
| 237 | function hasCSSTransform( |
| 238 | el: ElementWithTransition, |
| 239 | root: Node, |
| 240 | moveClass: string, |
| 241 | ): boolean { |
| 242 | // Detect whether an element with the move class applied has |
| 243 | // CSS transitions. Since the element may be inside an entering |
| 244 | // transition at this very moment, we make a clone of it and remove |
| 245 | // all other transition classes applied to ensure only the move class |
| 246 | // is applied. |
| 247 | const clone = el.cloneNode() as HTMLElement |
| 248 | const _vtc = el[vtcKey] |
| 249 | if (_vtc) { |
| 250 | _vtc.forEach(cls => { |
| 251 | cls.split(/\s+/).forEach(c => c && clone.classList.remove(c)) |
| 252 | }) |
| 253 | } |
| 254 | moveClass.split(/\s+/).forEach(c => c && clone.classList.add(c)) |
| 255 | clone.style.display = 'none' |
| 256 | const container = ( |
| 257 | root.nodeType === 1 ? root : root.parentNode |
| 258 | ) as HTMLElement |
| 259 | container.appendChild(clone) |
| 260 | const { hasTransform } = getTransitionInfo(clone) |
| 261 | container.removeChild(clone) |
| 262 | return hasTransform |
| 263 | } |
no test coverage detected