|
|
|
@ -9,7 +9,6 @@ interface HTMLExpandElement extends HTMLElement { |
|
|
|
_parent?: (Node & ParentNode & HTMLElement) | null; |
|
|
|
_initialStyle: { |
|
|
|
transition: string; |
|
|
|
visibility: string | null; |
|
|
|
overflow: string | null; |
|
|
|
height?: string | null; |
|
|
|
width?: string | null; |
|
|
|
@ -25,7 +24,6 @@ export default function (expandedParentClass = '', x = false) { |
|
|
|
el._parent = el.parentNode as (Node & ParentNode & HTMLElement) | null; |
|
|
|
el._initialStyle = { |
|
|
|
transition: el.style.transition, |
|
|
|
visibility: el.style.visibility, |
|
|
|
overflow: el.style.overflow, |
|
|
|
[sizeProperty]: el.style[sizeProperty], |
|
|
|
}; |
|
|
|
@ -35,7 +33,6 @@ export default function (expandedParentClass = '', x = false) { |
|
|
|
const initialStyle = el._initialStyle; |
|
|
|
|
|
|
|
el.style.setProperty('transition', 'none', 'important'); |
|
|
|
// Hide overflow to account for collapsed margins in the calculated height
|
|
|
|
el.style.overflow = 'hidden'; |
|
|
|
const offset = `${el[offsetProperty]}px`; |
|
|
|
|
|
|
|
@ -60,7 +57,6 @@ export default function (expandedParentClass = '', x = false) { |
|
|
|
leave(el: HTMLExpandElement) { |
|
|
|
el._initialStyle = { |
|
|
|
transition: '', |
|
|
|
visibility: '', |
|
|
|
overflow: el.style.overflow, |
|
|
|
[sizeProperty]: el.style[sizeProperty], |
|
|
|
}; |
|
|
|
@ -88,6 +84,6 @@ export default function (expandedParentClass = '', x = false) { |
|
|
|
const size = el._initialStyle[sizeProperty]; |
|
|
|
el.style.overflow = el._initialStyle.overflow!; |
|
|
|
if (size != null) el.style[sizeProperty] = size; |
|
|
|
Reflect.deleteProperty(el, '_initialStyle'); |
|
|
|
delete (el as any)._initialStyle; |
|
|
|
} |
|
|
|
} |
|
|
|
|