5

I've been using bootstrap-growl for some time (v1.0.6) and today I updated it to current v2.0.0.

Now growl call throws an exception from jQuery (v1.11 - it's matching bootstrap-growl dependencies)

Uncaught TypeError: Cannot read property 'ownerDocument' of undefined

Exactly in this block of jQuery

Sizzle.contains = function( context, elem ) {
    // Set document vars if needed
    if ( ( context.ownerDocument || context ) !== document ) {
        setDocument( context );
    }
    return contains( context, elem );
};

Which is quite fair - context is undefined, but I don't know why.

For now, I revert this update but how I can rid out of exception? Whan can cause the problem?

PS it's not an issue described here


Below my default options setting and call.

Default settings:

$.growl.default_options = {
        ele: "body",
        type: "info",
        allow_dismiss: true,
        position: {
            from: "top",
            align: "center"
        },
        offset: 20,
        spacing: 10,
        z_index: 1031,
        fade_in: 400,
        delay: 0, //delay of auto-closing
        pause_on_mouseover: true,
        onGrowlShow: null,
        onGrowlShown: null,
        onGrowlClose: null,
        onGrowlClosed: null,
        template: {
            icon_type: 'class',
            container: '<div class="col-xs-10 col-sm-10 col-md-5 alert     growl-animated">',
            dismiss: '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>',
            title: '<strong>',
            title_divider: '<br />',
            message: ''
        }
    };

Growl call

$.growl({ title: "some message" }, {
    type: 'success', 
    template: { 
        container: '<div class="col-xs-10 col-sm-10 col-md-5 alert growl-animated growl-icon-bg growl-success">' 
    });

Stack trace:

Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
jquery-1.11.0.js:1443 Sizzle.contains
jquery-1.11.0.js:5615 jQuery.extend.buildFragment
jquery-1.11.0.js:5885 jQuery.fn.extend.domManip
jquery-1.11.0.js:5704 jQuery.fn.extend.append
bootstrap-growl.min.js:2 p
bootstrap-growl.min.js:2 l
bootstrap-growl.min.js:2 f
bootstrap-growl.min.js:2 e.growl
Competences:578 showGrowlWithDelay
Piyush Bansal
  • 1,635
  • 4
  • 16
  • 39
michalczukm
  • 9,963
  • 6
  • 40
  • 47
  • I added stack trace and pointed that - `context` is undefined at this point, but I have no idea why. – michalczukm Feb 04 '15 at 09:05
  • 1
    Have you ever find any solution to this problem? I am facing the same issue in some use cases using [Parse.com](https://www.parse.com) and [Slick Carousel](https://kenwheeler.github.io/slick) – Alexandre Bourlier Nov 19 '15 at 11:52
  • 1
    @AlexandreBourlier I finally gave up and reverted all changes, that project is still using `bootstrap-growl` v1.0.6. Now I'm using `Toastr` in newer projects. – michalczukm Nov 19 '15 at 14:25

0 Answers0