我在本地看到此错误。当我附加一些特定的 DOM 时会发生这种情况:
TypeError: string is undefined
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
jquery.js (line 622)
它没有出现在生产中,但它不时在我本地发生。我调试了它,但找不到任何东西。我使用 jquery 1.8.2。
在这里发布它,希望其他人已经遇到过这个问题。(我不期待解决方案)
这是导致它的代码:
flash = function(type, message, secondaryMessage) {
var flash_location = $('.flash-location');
var secondary = '';
type = type || 'error';
message = message || (type == 'success' ? 'Success' : 'Error');
if(secondaryMessage){
secondary = '<p class="secondary">'+secondaryMessage+'</p>';
}
var top = 5;
flash_location.append($('<div class="flash"><div class="flash-content ' + type + '" style="top:'+top+'px;"><table><tr><td class="flash-icon"></td><td><p class="primary">' + message + '</p>'+secondary+'</td></tr></table></div></div>').fadeIn('normal'));
};