File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
core/src/components/router/utils Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,23 @@ export const readRoutes = (root: Element): RouteChain[] => {
3737 return flattenRouterTree ( readRouteNodes ( root ) ) ;
3838} ;
3939
40+ /**
41+ * Stencil patches `elm.children` to behave like calling `elm.children` on an
42+ * element with shadow DOM even though the `ion-router` is not a shadow DOM element.
43+ * To allow the `ion-router` to work properly we need to access the original accessor
44+ * for this property which is `__children`.
45+ */
46+ interface PatchedStencilElement extends Element {
47+ __children ?: HTMLCollection ;
48+ }
49+
4050/**
4151 * Reads the route nodes as a tree modeled after the DOM tree of <ion-route> elements.
4252 *
4353 * Note: routes without a component are ignored together with their children.
4454 */
45- export const readRouteNodes = ( node : Element ) : RouteTree => {
46- return ( Array . from ( node . children ) as HTMLIonRouteElement [ ] )
55+ export const readRouteNodes = ( node : PatchedStencilElement ) : RouteTree => {
56+ return ( Array . from ( node . __children ?? [ ] ) as HTMLIonRouteElement [ ] )
4757 . filter ( ( el ) => el . tagName === 'ION-ROUTE' && el . component )
4858 . map ( ( el ) => {
4959 const component = readProp ( el , 'component' ) as string ;
You can’t perform that action at this time.
0 commit comments