Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 2x 2x 62x 62x 62x 62x 62x 62x 4x 4x 4x 4x 62x 1x 62x 3x 59x 58x 58x 62x | import { type ElementWithTransition, vtcKey } from '../components/Transition' // compiler should normalize class + :class bindings on the same element // into a single binding ['staticClass', dynamic] export function patchClass( el: Element, value: string | null, isSVG: boolean, ): void { // directly setting className should be faster than setAttribute in theory // if this is an element during a transition, take the temporary transition // classes into account. const transitionClasses = (el as ElementWithTransition)[vtcKey] if (transitionClasses) { value = ( value ? [value, ...transitionClasses] : [...transitionClasses] ).join(' ') } if (value == null) { el.removeAttribute('class') } else if (isSVG) { el.setAttribute('class', value) } else { el.className = value } } |