Unsafe access to className
-
When a page contains
svg
element, the Q2W3 plugin will throw an exception. I do not know if that may cause unexpected behavior or not, but it should be fixed I think.The following shows the problem. Here is a piece of code from Q2W3 source.
mutations.forEach( function(mutation) {
if ( q2w3_exclude_mutations_array( q2w3_sidebar_options ).indexOf( mutation.target.id ) == -1 && mutation.target.className.indexOf( ‘q2w3-fixed-widget-container’ ) == -1 ) {
q2w3Refresh = true;
//console.log(‘Mutation detected!’);
}
});When
mutation.target
is ansvg
element, themutation.target.className
will be an instance ofSVGAnimatedString
instead ofArray
. Here we can not callindexOf
onSVGAnimatedString
because it is not defined. Thus the code above will throw an ‘undefined’ exception.For
svg
elements, we need another series of APIs to handle it, because they are so different from general elements.
- The topic ‘Unsafe access to className’ is closed to new replies.