我对这个控制台错误有点头疼,只在 Safari 上(实际上在 MacBook 上工作)。
我有这个功能:
function exists(element){
var exists = document.querySelector(element);
return exists;
}
在另一个函数中调用:
function includeHoverStylesheet(){
var path = $("body").attr("data-hover");
if (!("ontouchstart" in document.documentElement || exists("link[href='" + path + "'"))) {
var link = document.createElement("link");
link.rel = "stylesheet", link.href = path, document.head.appendChild(link) && document.body.removeAttribute("data-hover");
}
}
现在,在 Chrome 上就像一个魅力,但在 Safari 上,控制台会抛出这个错误:
1) Invalid CSS property declaration at: *
2) jQuery.Deferred exception: The string did not match the expected pattern.
3) SyntaxError (DOM Exception 12): The string did not match the expected pattern.
有人知道到底发生了什么???
提前谢谢各位!