Fix: MarkdownDeep resizer not working with JQuery 1.9 onwards

by John Nye

18 Nov
2013

As part of my custom comment system I utilized a great tool from TopTenSoftware called MarkDownDeep. I was using this in conjunction with Jquery 1.9.1 which unfortunately caused a small issue with the resizer functionality of the site.

As you can see from the demo pages below, the fix was fairly trivial:

Demo: Current version of MarkdownDeep with Jquery 1.9.1

Demo: Fixed version of MarkdownDeep with Jquery 1.9.1

After getting the source code form github it was simply a matter of locating the error, located in this.onResizerMouseDown:

// Handle click on resize bar
this.onResizerMouseDown = function (e) {
    // Initialize state
    var srcElement = (window.event) ? e.srcElement : e.target;

Debugging the file identified that e.srcElement was being used, but was null. In order to fix this I simply put a null check around e.srcElement and if it was null I use e.target as follows:

// Handle click on resize bar
this.onResizerMouseDown = function (e) {
    // Initialize state
    var srcElement = (window.event) ? e.srcElement ? e.target : e.srcElement : e.target;

And that was it. I am going to submit a pull request to the github repository to see if I can get some feedback on this fix and maybe incorporated into the live code.

Hope this helps someone out there with the same problem.

Don't forget to comment using my new Markdown enabled comment engine!

Comments 0 * Be the first to comment!

Leave a message...

18 Nov
2017