BorisMoore / jsviews

Interactive data-driven views, MVVM and MVP, built on top of JsRender templates
http://www.jsviews.com/#jsviews
MIT License
855 stars 130 forks source link

Bug - void tag inserted dynamically as markup #312

Closed albanul closed 9 years ago

albanul commented 9 years ago

Hi Boris,

I'm trying to render markup with img tag inside from string variable. It works fine with the self-closed tag img, but fails on img tag without selfclosing, although both variants of tag are correct.

Here is the sample: http://jsfiddle.net/y43cs47y/2/

Thanks!

BorisMoore commented 9 years ago

Yes, thanks - that is a bug. I have a fix for it which will be in the next commit.

If you want a local fix, you just need to change:

rConvertMarkers = /(^|(\/>)|<\/(\w+)>|)(\s*)([#\/]\d+(?:_|(\^)))`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*|(>))/g,

to

rConvertMarkers = /((\/>)|<\/(\w+)>|)(\s*)([#\/]\d+(?:_|(\^)))`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*|(>)|$)/g,
albanul commented 9 years ago

Thank you!

BorisMoore commented 9 years ago

This has been fixed with commit 65.