Opened 8 years ago
Closed 5 years ago
#15818 closed defect (patchwelcome)
_cleanSvg quote Ids Regex corrupts tags containing equals in Text Node
Reported by: | scadajack | Owned by: | Eric Durocher |
---|---|---|---|
Priority: | undecided | Milestone: | 1.13 |
Component: | DojoX GFX | Version: | 1.7.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
dojox/gfx/utils.js,
line 298,
_cleanSvg method, the following line:
svg = svg.replace(/[=]([^"']+?)(\s|>)/g,'="$1"$2')
used to quote attributes for an IE fix will cause certain text nodes to be corrupted.
e.g. the following code is :
'<text> see=bug</text>'.replace(/[=]([^"']+?)(\s|>)/g,'="$1"$2')
yields the following corrupted XML:
'<text> see="bug</text">'
The following regex will provide the quote function without corrupting the text:
svg = svg.replace(/(<\s*[^>\s]+\s*)([^>]*)(?=>)/g, function(mt,vtag,vattr){ return vtag + vattr.replace(/([\w-]+=)([^='"]+)(?=[\s>])/g, function(kk,iattr,ival){ return iattr + '"' + ival + '"'; }); });
Change History (4)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Owner: | changed from Eugene Lazutkin to Patrick Ruzand |
---|---|
Status: | new → assigned |
From #15994: possible workaround to avoid the unexpected replacement by quoting the inner string, like createText({text:"'a=b'"}).
comment:3 Changed 8 years ago by
Owner: | changed from Patrick Ruzand to Eric Durocher |
---|
comment:4 Changed 5 years ago by
Milestone: | tbd → 1.12 |
---|---|
Resolution: | → patchwelcome |
Status: | assigned → closed |
Given that no one has shown interest in creating a patch in the past 3+ years, I'm closing this as patchwelcome.
Note: See
TracTickets for help on using
tickets.
#15994 is a duplicate of this ticket.