Improved regex.

This commit is contained in:
Martin Edenhofer 2015-01-27 09:14:25 +01:00
parent 5e0ae554f9
commit 153d325e84
2 changed files with 5 additions and 1 deletions

View file

@ -193,4 +193,4 @@ class App.Utils
# cleanString = App.Utils.htmlAttributeCleanup( string )
@htmlAttributeCleanup: (string) ->
string.replace(/(\!|\s|\r|\t|,|\.|\?|"|'|\^|#|=|\(|\)|\$)/g, '')
string.replace(/((?![-a-zA-Z0-9_]+).|\n|\r|\t)/gm, '')

View file

@ -597,6 +597,10 @@ test( "check attibute validation", function() {
verify = App.Utils.htmlAttributeCleanup( string )
equal( verify, result, string )
string = "abc()=$\n123\rß"
result = 'abc123'
verify = App.Utils.htmlAttributeCleanup( string )
equal( verify, result, string )
});