修复 A 标签没有 href 属性时 link 值为 null 语法错,导致部分 A 标签事件不响应

This commit is contained in:
狂风代码 2022-03-26 10:36:19 +08:00 committed by GitHub
parent cc4e2915ec
commit a6800eef96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,9 @@
$(function() { $(function() {
$(document).on("click","a",function(event) { $(document).on("click","a",function(event) {
var link = $(this).attr("href"); var link = $(this).attr("href");
if ('string' != typeof(link)) {
return;
}
if(link.indexOf(":")>=0){ if(link.indexOf(":")>=0){
emitClickedEvent(link); emitClickedEvent(link);
return false; return false;