- 🇮🇹Italy apaderno Brescia, 🇮🇹
+ // Compatibility for Drupal 7 core (jQuery 1.4.4) and later versions. The + // live() function was removed in jQuery 1.9, but on() was only added in + // 1.6. + var elements = $('form.comment-form div.field-name-comment-body div.text-format-wrapper iframe:not(.cgprocessed)'); + // jQuery >= 1.6 can use this ... + if (typeof elements.on === 'function') { + $('form.comment-form div.field-name-comment-body div.text-format-wrapper').on('mouseover focus', 'iframe:not(.cgprocessed)', null, function() { + Drupal.behaviors.comment_goodness.handleEditors($(this)); + }) + } + // jQuery < 1.6 + else if (typeof elements.live === 'function') { + elements.live('mouseover focus', function () { + Drupal.behaviors.comment_goodness.handleEditors($(this)); }); + } + },
Since Drupal 7 uses jQuery 1.4.4 (< 1.6), the code should first check
elements.live
is a function, then checkelements.on
is a function, which is exactly the opposite of what the patch does.