admin管理员组文章数量:1426072
When I click on an SVG element I get an error on Chrome but not on Firefox.
If I use the Chrome's debugger it breaks in bubble_piled.js (Google's file) with an 'Uncaught TypeError: undefined is not a function'.
I know the underlying issue stems from ''.className returning an SVGAnimatedString (which doesn't have an indexOf method) and the correct thing to do is use .classNam e.baseVal but again this error is not part of my code rather it's part of google's code.
Here is a basic example:
<!DOCTYPE html>
<html>
<head>
<script>
function err() { alert('err'); }
</script>
</head>
<body>
<svg style="width:200px;height:200px; background-color: #00B7FF" onerror="err()"></svg>
</body>
</html>
Unfortunately this means that I can't debug my code that involved interactions with an svg element because Chrome debugger breaks on this error on mousedown.
Interestingly I didn't see this problem until two days ago (May 14th) and I've been developing such code for several years. I'm using Chrome 42 on the mac and I've tried using Chrome 40.0.2214.91 (64-bit) but now I get the same error (yes, I disabled Chrome automatic update :-) I don't see the problem in Firefox (with or without a debugger).
Another interesting observation is that the error doesn't occur if I load the above html from a file rather (file://) than via a server.
I tried to circumvent it by adding an indexOf() to SVGAnimatedString (or its prototype) but this is native code and it doesn't work.
Adding onmousedown to the svg element doesn't help because the exception occurs before my function is called.
All I need for now is a way to tell Chrome not to break on this error.
When I click on an SVG element I get an error on Chrome but not on Firefox.
If I use the Chrome's debugger it breaks in bubble_piled.js (Google's file) with an 'Uncaught TypeError: undefined is not a function'.
I know the underlying issue stems from ''.className returning an SVGAnimatedString (which doesn't have an indexOf method) and the correct thing to do is use .classNam e.baseVal but again this error is not part of my code rather it's part of google's code.
Here is a basic example:
<!DOCTYPE html>
<html>
<head>
<script>
function err() { alert('err'); }
</script>
</head>
<body>
<svg style="width:200px;height:200px; background-color: #00B7FF" onerror="err()"></svg>
</body>
</html>
Unfortunately this means that I can't debug my code that involved interactions with an svg element because Chrome debugger breaks on this error on mousedown.
Interestingly I didn't see this problem until two days ago (May 14th) and I've been developing such code for several years. I'm using Chrome 42 on the mac and I've tried using Chrome 40.0.2214.91 (64-bit) but now I get the same error (yes, I disabled Chrome automatic update :-) I don't see the problem in Firefox (with or without a debugger).
Another interesting observation is that the error doesn't occur if I load the above html from a file rather (file://) than via a server.
I tried to circumvent it by adding an indexOf() to SVGAnimatedString (or its prototype) but this is native code and it doesn't work.
Adding onmousedown to the svg element doesn't help because the exception occurs before my function is called.
All I need for now is a way to tell Chrome not to break on this error.
Share Improve this question asked May 16, 2015 at 18:55 YardenYarden 1316 bronze badges1 Answer
Reset to default 11Turns out the issue is due to Google's Translate extension. Disabling it solve the problem.
本文标签: javascriptChrome and a TypeError due to SVGAnimatedStringStack Overflow
版权声明:本文标题:javascript - Chrome and a TypeError due to SVGAnimatedString - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745464305a2659464.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论