Opened 7 years ago

Closed 3 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:


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,
    return vtag + vattr.replace(/([\w-]+=)([^='"]+)(?=[\s>])/g,							 
	  return iattr + '"' + ival + '"';

Change History (4)

comment:1 Changed 7 years ago by Patrick Ruzand

#15994 is a duplicate of this ticket.

comment:2 Changed 7 years ago by Patrick Ruzand

Owner: changed from Eugene Lazutkin to Patrick Ruzand
Status: newassigned

From #15994: possible workaround to avoid the unexpected replacement by quoting the inner string, like createText({text:"'a=b'"}).

comment:3 Changed 6 years ago by Eric Durocher

Owner: changed from Patrick Ruzand to Eric Durocher

comment:4 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: assignedclosed

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.