JQuery 1.9.1 breaks the workflow editor


Since the upgrade of JQuery, the Worflow Editor doesn't work :

Uncaught Error: Syntax error, unrecognized expression:
<div class="event canStart activity-content-created" title="Content is created."> <div>Content Created</div> </div>

file attachments


JasperD wrote Apr 3, 2013 at 9:55 AM

The exception is caused by the stricter handling of $(htmlstring) as documented here: http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring

By replacing var dom = $(data); with var dom = $($.parseHTML(data)); in orchard-workflows.js on line 88 the problem can be fixed. The next exception is then raised on line 138 when calling jsPlumb.addEndpoint. ;-)

agriffard wrote Apr 8, 2013 at 12:51 PM

OK, http://jsplumbtoolkit.com/ doesn't seem to like JQuery 1.9
The second exception is difficult to fix because the min version of jsplumb is used.
BTW, it should be a script added in the ResourceManifest.

Jetski5822 wrote Apr 9, 2013 at 8:22 AM

I can contact the owner... but before I do, has anyone else already done this?

agriffard wrote Apr 9, 2013 at 9:01 AM

I haven't found a way to submit an issue on the github project.

If you can contact him, it would help.

JasperD wrote Apr 13, 2013 at 1:10 AM

It took me some time, but I found out what’s going wrong. The problem is, that the response (data) is surrounded by some whitespaces.
$(data) (jquery < 1.9) ignored surrounding whitespaces, but jquery 1.9 does not. Hence the jquery object contains three DOM nodes (instead of one), two of them are text nodes. Because jsPlumb iterates over all DOM nodes, something within jsPlumb goes wrong (not sure what exactly is happening there).

Trimming the response before parsing it solves the issue.

var dom = $($.parseHTML($.trim(data)));

JasperD wrote Apr 13, 2013 at 1:28 AM

Submitted a wrong patch (6911), 6907 is the right one.

agriffard wrote Apr 13, 2013 at 3:21 PM

Fixed in changeset 637a3ab43c9f

sfmskywalker wrote Mar 28, 2014 at 12:28 AM

Fixed in changeset 0cedb4f2580c69c42993426e2edc54a881ad69c7