/
githubmirror
/
ionic
Обзор
Документация
Войти
/
githubmirror
/
ionic
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react-router/src/ReactRouter/clonePageElement.ts
20 строк
635 B
Ely Lucas
feat(react): React Router Enhancements (#21693)
07 июл 2020, 20:02
Не верифицирован
07 июл 2020, 20:02
c171ccb
Код
Авторство
О чём код?
export function clonePageElement(leavingViewHtml: string | HTMLElement) { let html: string; if (typeof leavingViewHtml === 'string') { html = leavingViewHtml; } else { html = leavingViewHtml.outerHTML; } if (document) { const newEl = document.createElement('div'); newEl.innerHTML = html; newEl.style.zIndex = ''; // Remove an existing back button so the new element doesn't get two of them const ionBackButton = newEl.getElementsByTagName('ion-back-button'); if (ionBackButton[0]) { ionBackButton[0].remove(); } return newEl.firstChild as HTMLElement; } return undefined; }