Problem/Motivation

The module is working fine with the default drupal core version.On the upgradation of the jquery version to above 1.9 using jquery_update module.It displayed the error and the module stops working, because jquery.live has been removed from jquery 1.9 and it has been replaced with jquery.On
Attached is the patch that work jquery update module.

Original Reported by @doidd

I have problem with Syntaxhighlighter Insert. Syntaxhighlighter Insert don't work with live() js function ( i use jquery 1.10). When i open Chrome developer tools , i see error "Uncaught TypeError: undefined is not a function" in file syntaxhighlighter_insert.js because not have class .syntaxhighlighter-insert-text-description-link and .syntaxhighlighter-insert-wysiwyg-description-link. So i replace live() js function with on(). It work fine for me. I hope you update for next version. Thank you! Sorry my english not good.

Proposed resolution

  1. Patch Attached.
  2. Can we specify on the project page about the module issue with jquery update module ?

Remaining tasks

Needs Maintainers eyes

User interface changes

None

API changes

Comments

doidd’s picture

Priority: Critical » Normal
sri20198’s picture

Subscribe.

After enabling jQuery Update module, the Syntaxhighlighter Insert throws error and does not work.
Temporarily fixed it using a custom JS function to override:


(function ($) {
// http://stackoverflow.com/questions/8021436/turning-live-into-on-in-jquery
// Borrowed from jQuery 1.8.3's source code
jQuery.fn.extend({
	live: function( types, data, fn ) {
		if( window.console && console.warn ) {
			console.warn( "jQuery.live is deprecated. Use jQuery.on instead." );
		}

		jQuery( this.context ).on( types, this.selector, data, fn );
		return this;
	}
});

}(jQuery));

Hope it gets fixed ASAP.

saki007ster’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new711 bytes

Patch attached that works with jquery > 1.9

baher’s picture

Hi,

The solution is to replace the Jquery live function on line 36 of the file syntaxhighlighter_insert.js which is depredated since jquery 1.9.
So replace this line :

jQuery('.syntaxhighlighter-insert-text-description-link, .syntaxhighlighter-insert-wysiwyg-description-link').live('click', function() {

by this one :

jQuery('.syntaxhighlighter-insert-text-description-link, .syntaxhighlighter-insert-wysiwyg-description-link').on('click', function() {

Baher

avpaderno’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Issue tags: -Syntaxhighlighter Insert, -Syntaxhighlighter Insert live(), -Syntaxhighlighter Insert on()