Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ string.js - Copyright (C) 2012-2014, JP Richardson <[email protected]>
stripTags: function() { //from sugar.js
var s = this.s, args = arguments.length > 0 ? arguments : [''];
multiArgs(args, function(tag) {
s = s.replace(RegExp('<\/?' + tag + '[^<>]*>', 'gi'), '');
s = s.replace(RegExp('<(\\/)?(' + (tag || '[^\\s>]+') + ')(\\s+[^<>]*?)?\\s*(\\/)?>', 'gi'), '');
});
return new this.constructor(s);
},
Expand Down
1 change: 1 addition & 0 deletions test/string.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@
it('should strip all of the html tags or tags specified by the parameters', function() {
T (S('<p>just <b>some</b> text</p>').stripTags().s === 'just some text')
T (S('<p>just <b>some</b> text</p>').stripTags('p').s === 'just <b>some</b> text')
T (S('<i>just</i> some <image/> text').stripTags('i').s === 'just some <image/> text')
})
})

Expand Down