abhikmitra / ng-joyride

Angular Joyride Directive for creating custom introductions to websites
126 stars 68 forks source link

Cannot read property 'ownerDocument' of undefined on Element types #60

Open scotteza opened 8 years ago

scotteza commented 8 years ago

This line of code: $fkEl.popover('show');

Throws the exception:

angular.js:11594 TypeError: Cannot read property 'ownerDocument' of undefined (full stack at the end of this comment).

With a breakpoint on $fkEl.popover('show');, I can see that the selector has found my element, but for some reason is throwing this exception. What am I doing wrong?

The stack trace is as follows:

angular.js:11594 TypeError: Cannot read property 'ownerDocument' of undefined at Function.gb.contains (http://localhost/bower_components/jquery/dist/jquery.min.js:2:12147) at Function.n.extend.buildFragment (http://localhost/bower_components/jquery/dist/jquery.min.js:3:14212) at n.fn.extend.domManip (http://localhost/bower_components/jquery/dist/jquery.min.js:3:16801) at n.fn.extend.after (http://localhost/bower_components/jquery/dist/jquery.min.js:3:15338) at n.each.n.fn.(anonymous function) as insertAfter at c.show (http://localhost/bower_components/bootstrap/dist/js/bootstrap.min.js:6:22544) at HTMLSpanElement. (http://localhost/bower_components/bootstrap/dist/js/bootstrap.min.js:6:27388) at Function.n.extend.each (http://localhost/bower_components/jquery/dist/jquery.min.js:2:2882) at n.fn.n.each (http://localhost/bower_components/jquery/dist/jquery.min.js:2:847) at b as popover

compsagnathus commented 8 years ago

I am also having this same issue - the element clearly gets selected, but in debugging the code it seems to call apart somewhere near

        function _showTooltip() {
            var self =this;
            $timeout(function () {
                $fkEl.popover('show');
scotteza commented 8 years ago

@compsagnathus, I realised that there is a bug in the downloadable code which is fixed in the demo page. I diff'd the code from the root project, and the code on this page: http://abhikmitra.github.io/ng-joyride-demo/#/ and found minor differences.

So, just replace the version you are using with the ng-joyride.js on the demo page and it will work!

compsagnathus commented 8 years ago

thanks so much!

Fr0ozen commented 8 years ago

hello, can you explain the source of this bug please? I have the same bug and i have brought enormously modification to the original code, so I can't replace my code with the code in the demo page

scotteza commented 8 years ago

@Fr0ozen I don't know the exact details, I just know the demo version worked where the version on GitHub didn't.

To see the differences, diff the code between commit c599569 on this project and the code here: http://abhikmitra.github.io/ng-joyride-demo/bower_components/ng-joyride/ng-joyride.js using any diff tool (winmerge etc.).

You should then be able to merge these changes into your updated code.