Let’s try re-writing the getPreviousSibling function! Could you replace the current function from line 1171 with this?
function getPreviousSibling( elem, selector ) {
// Get the previous sibling element
var sibling = elem.previousElementSibling,
matchingElements = document.querySelectorAll( selector );
// If the sibling matches our selector, use it; otherwise move on to the next sibling
while ( sibling ) {
for ( var i = 0, n = matchingElements.length; i < n; i++ ) {
if ( sibling === matchingElements[i] ) {
return sibling;
}
}
sibling = sibling.previousElementSibling;
}
}
Note: you will need to make sure that your site has define( 'SCRIPT_DEBUG', true ); included in its wp-config.php file (just above /* That's all, stop editing! Happy blogging. */) because otherwise this file will be ignored and the minified file will be used instead.