LambrechtsWouter / jsplumb

Automatically exported from code.google.com/p/jsplumb
0 stars 0 forks source link

escape label HTML #257

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Labels are currently being applied with innerHTML in 
jsPlumb.Overlays.getTextDimensions ( 
https://github.com/sporritt/jsPlumb/blob/master/js/1.3.10/jsPlumb-defaults-1.3.1
0-RC1.js#L1048 ). Thus, they are being treated as HTML rather than text, as 
seen in this jsFiddle:

http://jsfiddle.net/Ha4kL/14/

I consider this behavior unexpected, based on the setLabel documentation ( 
http://jsplumb.org/apidocs/files/jquery-jsPlumb-1-3-9-all-js.html#setLabel ). I 
recognize that there could be backward compatibility issues here, but if so, I 
would suggest adding a setLabelText and noting in the documentation that 
setLabel expects HTML.

Thank you for all your work.

Original issue reported on code.google.com by bluej...@gmail.com on 20 Jun 2012 at 8:46

GoogleCodeExporter commented 8 years ago
I'm not really sure i want to do this. If you need to escape the HTML then you 
can do so; adding functionality to the library to cater for this seems like 
unnecessary complexity to me.  I will add a note to the API docs for setLabel 
to make it clearer.

Original comment by simon.po...@gmail.com on 21 Jun 2012 at 6:03

GoogleCodeExporter commented 8 years ago
done in 1.3.10 dev

Original comment by simon.po...@gmail.com on 21 Jun 2012 at 6:05

GoogleCodeExporter commented 8 years ago
I don't think that using a TextNode rather than innerHTML is really "adding 
functionality to the library", but thanks for at least updating the docs.

Original comment by bluej...@gmail.com on 21 Jun 2012 at 5:14

GoogleCodeExporter commented 8 years ago
it's just an issue of whether or not it is necessary.  if i added a new 
function then the user would have to make the decision to use one or the other 
function in their own code - you still have to do _something_.  may as well 
leave jsPlumb to do what it does best and deal with app specific stuff like 
this in the user's code.

Original comment by simon.po...@gmail.com on 21 Jun 2012 at 8:22

GoogleCodeExporter commented 8 years ago

Original comment by simon.po...@gmail.com on 22 Jun 2012 at 3:41