我已经使用bootstrap-growl
了一段时间(v1.0.6),今天我将它更新到当前的 v2.0.0。
现在,咆哮调用会从 jQuery 抛出异常(v1.11 - 它匹配 bootstrap-growl 依赖项)
Uncaught TypeError: Cannot read property 'ownerDocument' of undefined
正是在这个 jQuery 块中
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
这很公平 -context
未定义,但我不知道为什么。
现在,我恢复了这个更新,但我怎样才能摆脱异常呢?什么会导致问题?
PS这不是这里描述的问题
下面我的默认选项设置和调用。
默认设置:
$.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">×</button>',
title: '<strong>',
title_divider: '<br />',
message: ''
}
};
咆哮声
$.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">'
});
堆栈跟踪:
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