Also remove svg in htmlCleanup(), htmlRemoveTags() and htmlRemoveRichtext().
This commit is contained in:
parent
b3aa055c0e
commit
bcde9a3695
2 changed files with 12 additions and 12 deletions
|
@ -116,7 +116,7 @@ class App.Utils
|
|||
)
|
||||
|
||||
# remove tags & content
|
||||
html.find('div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, br, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
html.find('div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, br, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
|
||||
html
|
||||
|
||||
|
@ -138,7 +138,7 @@ class App.Utils
|
|||
)
|
||||
|
||||
# remove tags & content
|
||||
html.find('li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, address, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
html.find('li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, address, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
|
||||
html
|
||||
|
||||
|
@ -155,7 +155,7 @@ class App.Utils
|
|||
@_removeWordMarkup(html)
|
||||
|
||||
# remove tags, keep content
|
||||
html.find('a, font, small, time').replaceWith( ->
|
||||
html.find('a, font, small, time, form').replaceWith( ->
|
||||
$(@).contents()
|
||||
)
|
||||
|
||||
|
@ -179,7 +179,7 @@ class App.Utils
|
|||
)
|
||||
|
||||
# remove tags & content
|
||||
html.find('form, font, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
html.find('font, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
|
||||
|
||||
html
|
||||
|
||||
|
|
|
@ -246,7 +246,7 @@ test("htmlRemoveTags", function() {
|
|||
result = App.Utils.htmlRemoveTags($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><form class=\"xxx\">test 123</form></div>"
|
||||
source = "<div><form class=\"xxx\">test 123</form><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
|
||||
//should = "<div>test 123</div>"
|
||||
should = "test 123"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
|
@ -345,7 +345,7 @@ test("htmlRemoveRichtext", function() {
|
|||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><font size=\"3\" color=\"red\">This is some text!</font></div>"
|
||||
source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
|
||||
//should = "<div>This is some text!</div>"
|
||||
should = "This is some text!"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
|
@ -400,31 +400,31 @@ test("htmlCleanup", function() {
|
|||
source = "<div><div class=\"xxx\"><br></div></div>"
|
||||
//should = "<div><div><br></div></div>"
|
||||
should = "<div><br></div>"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
result = App.Utils.htmlCleanup($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><form class=\"xxx\">test 123</form></div>"
|
||||
//should = "<div>test 123<br></div>"
|
||||
should = "test 123"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
result = App.Utils.htmlCleanup($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><form class=\"xxx\">test 123</form> some other value</div>"
|
||||
//should = "<div>test 123 some other value</div>"
|
||||
should = "test 123 some other value"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
result = App.Utils.htmlCleanup($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><form class=\"xxx\">test 123</form> some other value<input value=\"should not be shown\"></div>"
|
||||
//should = "<div>test 123 some other value</div>"
|
||||
should = "test 123 some other value"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
result = App.Utils.htmlCleanup($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><font size=\"3\" color=\"red\">This is some text!</font></div>"
|
||||
source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
|
||||
//should = "<div>This is some text!</div>"
|
||||
should = "This is some text!"
|
||||
result = App.Utils.htmlRemoveRichtext($(source))
|
||||
result = App.Utils.htmlCleanup($(source))
|
||||
equal(result.html(), should, source)
|
||||
|
||||
source = "<div><p>some link to somewhere from word<w:sdt>abc</w:sdt></p><o:p></o:p></a>"
|
||||
|
|
Loading…
Reference in a new issue