You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My input document uses the br tag inside of a foreign object. It uses the form <br />
The regex in svg() continues to produce valid markup:
"this is valid <br />".replace(/<(\w+)([^<]+?)\/>/g, '<$1$2></$1>')
produces what it should produce:
"this is valid <br ></br>"
However, then along comes the assignment to well.innerHTML and (on Chrome Version 35.0.1916.114) the HTML parser messes everything up. It replaces the correctly closed br tag with two unclosed br tags - as can be seen by the following console output
> well.innerHTML = "this is valid <br />".replace(/<(\w+)([^<]+?)\/>/g, '<$1$2></$1>')
"this is valid <br ></br>"
> well.innerHTML
"this is valid <br><br>" // it's still valid html markup but not valid svg nor does it match the initial format
I don't think the regex should be changed - but there may need to be special handling for br (and hr plus any others?)
The text was updated successfully, but these errors were encountered:
I have a hackish fix in place - I break the well formed tag by replacing <br /> with <br> so that your regex fixes them and it seems to give me the desired output. I'm not entirely sure why that works - but it does.
However, I think the "ultimate" solution would be for your import routine to not touch anything inside of a foreignObject tag. As you rightly say the content inside of the foreignObject tag is nothing to do with svg - because of that the contents shouldn't really be affected by your import routine...
However, I'm sure it's a low priority edge case for svg.js to deal with.
Great to hear you found a fix. Although, it might be a good idea to rework the import plugin to "adopt" html nodes in the foreignObject rather than importing them individually.
My input document uses the br tag inside of a foreign object. It uses the form <br />
The regex in svg() continues to produce valid markup:
produces what it should produce:
However, then along comes the assignment to well.innerHTML and (on Chrome Version 35.0.1916.114) the HTML parser messes everything up. It replaces the correctly closed br tag with two unclosed br tags - as can be seen by the following console output
I don't think the regex should be changed - but there may need to be special handling for br (and hr plus any others?)
The text was updated successfully, but these errors were encountered: