I found this in moodle/lib/editor/tinymce/lib,php...which makes me suspect there is a bug in there somewhere!
if (!empty($options['legacy']) or !empty($options['noclean']) or !empty($options['trusted'])) {
// now deal somehow with non-standard tags, people scream when we do not make moodle code xtml strict,
// but they scream even more when we strip all tags that are not strict :-(
$params['valid_elements'] = 'script[src|type],*[*]'; // for some reason the *[*] does not inlcude javascript src attribute MDL-25836
$params['invalid_elements'] = '';
}
// Add unique moodle elements - unfortunately we have to decide if these are SPANs or DIVs.
$params['extended_valid_elements'] = 'nolink,tex,algebra,lang[lang]';
$params['custom_elements'] = 'nolink,~tex,~algebra,lang';
//Add onblur event for client side text validation
if (!empty($options['required'])) {
$params['init_instance_callback'] = 'M.editor_tinymce.onblur_event';
}
// Allow plugins to adjust parameters.
editor_tinymce_plugin::all_update_init_params($params, $context, $options);
// Remove temporary parameters.
unset($params['moodle_config']);
return $params;
}