У меня небольшая головная боль с этой консольной ошибкой, ТОЛЬКО на Safari (фактически работает на MacBook).jQuery.Deferred exception: строка не соответствует ожидаемому шаблону
У меня есть эта функция:
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 работает как шарм, но на сафари консоли бросить эту ошибку:
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.
У кого-то есть идея, что происходит? ???
Спасибо заранее, ребята!
Строка, передаваемая 'существует()' имеет отверстие '[' но не ']', что достаточно, чтобы вызвать ошибку. –