File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 1
1
import forEach from "../util/forEach" ;
2
2
import showElement from "./showElement" ;
3
3
import exitIntro from "./exitIntro" ;
4
+ import waitForElement from "../util/waitForElement" ;
4
5
5
6
/**
6
7
* Go to specific step of introduction
@@ -59,7 +60,8 @@ export function nextStep() {
59
60
if ( typeof this . _introBeforeChangeCallback !== "undefined" ) {
60
61
continueStep = this . _introBeforeChangeCallback . call (
61
62
this ,
62
- nextStep && nextStep . element
63
+ nextStep &&
64
+ ( elementBySelectorNotExists ( nextStep ) ? undefined : nextStep . element )
63
65
) ;
64
66
}
65
67
@@ -79,7 +81,21 @@ export function nextStep() {
79
81
return ;
80
82
}
81
83
82
- showElement . call ( this , nextStep ) ;
84
+ if ( elementBySelectorNotExists ( nextStep ) ) {
85
+ waitForElement ( nextStep . _element , ( ) => showElement . call ( this , nextStep ) ) ;
86
+ } else {
87
+ showElement . call ( this , nextStep ) ;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Return true if element locates by selector and doesn't exists yet
93
+ */
94
+ function elementBySelectorNotExists ( step ) {
95
+ return (
96
+ typeof step . _element === "string" &&
97
+ document . querySelector ( step . _element ) === null
98
+ ) ;
83
99
}
84
100
85
101
/**
You can’t perform that action at this time.
0 commit comments