Snap.svg and javascript throws Uncaught SyntaxError

Snap.svg and javascript throws Uncaught SyntaxError

本文关键字:Uncaught SyntaxError throws javascript svg and Snap      更新时间:2023-09-26

我对Snap.svg和javascript有问题。我正在尝试在mouseEnter事件上对svg进行动画处理,但是在触发事件时出现错误:

未捕获的

语法错误:意外的标识符本地主机/:3 未捕获 语法错误:意外的标识符

在此错误中,我发现:

(function(val
     /**/) {
     return Snap.path.toString.call([[object Array]])            //error in this line
})

我的代码如下所示:

 function init() {
    var speed = 250,
        easing = mina.easeinout;
    [].slice.call(document.querySelectorAll('.gallery  figure')).forEach(function(el) {

            var s = Snap(el.querySelector('svg')),
                path = s.select('path'),
                pathConfig = {
                    from: path.attr('d'),
                    to: el.getAttribute('data-path-hover')
                };
            el.addEventListener('mouseenter', function() {
                path.animate({
                    'path': pathConfig.to
                }, speed, easing);
            });
            el.addEventListener('mouseleave', function() {
                path.animate({
                    'path': pathConfig.from
                }, speed, easing);
            });
        });
}
显然

错误只存在于OS X chrome beta上,没有其他地方发生。我将等待下一次chrome更新,看看它是否得到解决。