(nativeNav: HTMLElement)
| 68 | } |
| 69 | |
| 70 | function replace(nativeNav: HTMLElement): void { |
| 71 | // Final check to avoid duplicates in any scenario. |
| 72 | if (elementExists('.rgh-extensible-nav')) { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | const items = $$('a', nativeNav); |
| 77 | nativeNav.before( |
| 78 | <nav className="UnderlineNav rgh-extensible-nav px-4"> |
| 79 | <ul className="UnderlineNav-body"> |
| 80 | {items.map(item => generateTab(item))} |
| 81 | </ul> |
| 82 | </nav>, |
| 83 | ); |
| 84 | |
| 85 | nativeNav.classList.add('rgh-extensible-nav-removed'); |
| 86 | isReady = true; |
| 87 | } |
| 88 | |
| 89 | async function initOnce(): Promise<void> { |
| 90 | // Use `element-ready` to ensure that the native navigation is fully loaded before replacing it for the first time. |
nothing calls this directly
no test coverage detected