Mercurial > libervia-web
diff src/browser/sat_browser/html_tools.py @ 848:7dafa5ee809a
browser: replace re module usage by pure javascript
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 15 Jan 2016 16:33:08 +0100 |
parents | f8a7a046ff9c |
children | fd4eae654182 |
line wrap: on
line diff
--- a/src/browser/sat_browser/html_tools.py Fri Jan 15 12:30:21 2016 +0100 +++ b/src/browser/sat_browser/html_tools.py Fri Jan 15 16:33:08 2016 +0100 @@ -20,7 +20,7 @@ from sat_frontends.tools import xmltools import nativedom -import re +from __pyjamas__ import JS dom = nativedom.NativeDOM() @@ -32,10 +32,7 @@ def html_strip(html): """Strip leading/trailing white spaces, HTML line breaks and sequences.""" - cleaned = re.sub(r"^(<br/?>| |\s)+", "", html) - cleaned = re.sub(r"(<br/?>| |\s)+$", "", cleaned) - return cleaned - + JS("""return html.replace(/(^(<br\/?>| |\s)+)|((<br\/?>| |\s)+$)/g, "");""") def inlineRoot(xhtml): """ make root element inline """