Closed GoogleCodeExporter closed 8 years ago
hmm, i dont know about this. i dont want to have to escape every id.
Original comment by simon.po...@gmail.com
on 5 Feb 2013 at 1:01
i'd like to help you with this problem, but i'm fairly new to javascript and
jQuery.
is it possible to substitute the brackets with other chars (maybe '_sqbr_' for
sqare brackets), so jsPlumb doesn't get confused with them. and at the and you
convert them back
Original comment by oliver.e...@in2code.de
on 5 Feb 2013 at 9:05
i really dont want to add some code to jsplumb that runs a string replace every
time it wants to use an id.
if you really want to use brackets then you can override the jsplumb method
that does a selector lookup - see this fiddle:
http://jsfiddle.net/2hW84/10/
the code you need is this (you would include this after jsplumb):
var gel = jsPlumb.CurrentLibrary.getElementObject; // store ref to original
jsPlumb.CurrentLibrary.getElementObject = function(el) {
// if given a string, perform replacement
if (typeof el == "string")
el = el.replace("[", "\\[").replace("]", "\\]");
// now pass that id with escaped brackets to the original method
return gel(el);
};
Original comment by simon.po...@gmail.com
on 5 Feb 2013 at 9:16
a thousand thanks :)
works fine!
Original comment by oliver.e...@in2code.de
on 5 Feb 2013 at 10:17
ok cool. glad it works. i'm gonna close the issue out as a wontfix.
Original comment by simon.po...@gmail.com
on 5 Feb 2013 at 10:28
if someone wants to use jsPlumb.addEnpoint with multiple index:
http://jsfiddle.net/2hW84/11/
or use:
var gel = jsPlumb.CurrentLibrary.getElementObject;
jsPlumb.CurrentLibrary.getElementObject = function(el) {
if (typeof el == "string")
el = el.replace(/\[/g, "\\[").replace(/\]/g, "\\]");
return gel(el);
};
i just inserted a regular expression, so all occurences get replaced :D
Original comment by oliver.e...@in2code.de
on 5 Feb 2013 at 1:23
Original issue reported on code.google.com by
oliver.e...@in2code.de
on 5 Feb 2013 at 12:04