I'm working with a MutationObserver to change the values of some variables when I switch the content of a panel (I'm useing Bootstrap tabs). Everything is working just fine in Chrome and Firefox, but for some reason, when I test it with IE, it shows a syntax error in the console and the script breaks. This is my MutationObserver code:
var observer = new MutationObserver(function (MutationRecords, MutationObserver) {
dataTable = null;
tabla = null;
tabActiva = $('.tab-content').find('.active');
formFiltro = tabActiva.find('form');
tabla = tabActiva.find('table');
});
observer.observe(target, {
childList: true,
attributeFilter: ['class'],
subtree: true
});
Console points the error is on the observer.observe(). I don't know what's happening. Thanks in advance.

Just in case, this is my "target":
var target = $('.tab-content > .tab-pane').get(0);
With a MutationObserver, it's possible to filter attributes, but only if you are observing element attributes to begin with. Therefore the option attributeFilter is only applicable if attributes is set to true.
If you specify an attributeFilter without setting attributes to true, then IE11 will throw a syntax error, while Chrome and Firefox will just silently ignore attributeFilter.
To resolve the syntax error, either set attributes to true or remove the attributeFilter.
attributeFilter property is specified, there's no need to also set
attributestotrue, as it's implied.
attributeFilter asSet to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and
attributesistrueor omitted.
attributeFilter set also attributes: true. If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With