Skip to content

Commit 0904d58

Browse files
Handle web components (polymer shadow dom)
Limit steps to 1, have to destroy intro js and recreate a new one for every step
1 parent 2dffc37 commit 0904d58

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

intro.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@
120120

121121
} else {
122122
//use steps from data-* annotations
123-
var allIntroSteps = targetElm.querySelectorAll('*[data-intro]');
123+
var allIntroSteps = [targetElm.querySelector('*[data-intro]')];
124+
124125
//if there's no element to intro
125-
if (allIntroSteps.length < 1) {
126+
if (allIntroSteps.length < 1 || !allIntroSteps[0]) {
126127
return false;
127128
}
128129

@@ -1015,7 +1016,7 @@
10151016

10161017
var parentElm = targetElement.element.parentNode;
10171018
while (parentElm != null) {
1018-
if (parentElm.tagName.toLowerCase() === 'body') break;
1019+
if (!parentElm.tagName || parentElm.tagName.toLowerCase() === 'body') break;
10191020

10201021
//fix The Stacking Contenxt problem.
10211022
//More detail: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context
@@ -1087,7 +1088,7 @@
10871088
function _isFixed(element) {
10881089
var p = element.parentNode;
10891090

1090-
if (p.nodeName === 'HTML') {
1091+
if (!p || p.nodeName === 'HTML') {
10911092
return false;
10921093
}
10931094

@@ -1150,7 +1151,7 @@
11501151
overlayLayer.className = 'introjs-overlay';
11511152

11521153
//check if the target element is body, we should calculate the size of overlay layer in a better way
1153-
if (targetElm.tagName.toLowerCase() === 'body') {
1154+
if (!targetElm.tagName || targetElm.tagName.toLowerCase() === 'body') {
11541155
styleText += 'top: 0;bottom: 0; left: 0;right: 0;position: fixed;';
11551156
overlayLayer.setAttribute('style', styleText);
11561157
} else {

0 commit comments

Comments
 (0)