Chrome and TypeError due to SVGAnimatedString

When I click on an SVG element, I get an error message in Chrome, but not in Firefox.

If I use the Chrome debugger, it breaks in the bubble_compiled.js file (Google file) using "Uncaught TypeError: undefined is not a function".

I know that the main problem is with '.className returning SVGAnimatedString (which does not have indexOf method) and the right thing to do is to use .classNam e.baseVal, but again this error is not part of my code rather it is part of the google code.

Here is an 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 code related to interacting with the svg element, as the Chrome debugger breaks this error in mousedown.

Interestingly, I did not see this problem until two days ago (May 14), and I developed this code for several years. I use Chrome 42 on a Mac and I tried to use Chrome 40.0.2214.91 (64-bit), but now I get the same error (yes, I turned off the automatic update of Chrome :-) I do not see a problem in Firefox (with or without debugger )

Another interesting point is that the error does not occur if I load the above html from a file (file: //), and not through the server.

I tried to get around this by adding indexOf () to SVGAnimatedString (or its prototype), but this is native code and it does not work.

Adding onmousedown to the svg element does not help, because an exception occurs before my function is called.

All I need now is to indicate that Chrome should not interrupt this error.

+2
source share
1 answer

It turns out the problem is with the Google Translate extension. Disabling this solution to the problem.

+11
source

Source: https://habr.com/ru/post/988066/


All Articles