Opened 8 years ago
Closed 8 years ago
#15994 closed defect (duplicate)
dojox.gfx.utils.toSvg creates broken svg files when a text shape contains "="
Reported by: | redstone | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | DojoX GFX | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The dojox.gfx.utils.toSvg function creates invalid svg format data if an input surface contains the text shape with "=" as its inner string.
e.g. for the text shape like createText({text:"a=b"}), the output svg would be <svg><text>a="b</text"></svg>
This seems due to the string replacement in the function dojox.gfx.utils._cleanSvg. In the function _cleanSvg, the regex replacement, svg.replace(/[=](["']+?)(\s|>)/g,'="$1"$2') in the source code, must take place only in svg tags while the above example is not.
I currently avoid the unexpected replacement by quoting the inner string, like createText({text:"'a=b'"}).
thanks.
Duplicate of #15818.