Skip to content

Commit 71f3088

Browse files
committed
chore(release): Build Dist files
1 parent f7d34a3 commit 71f3088

File tree

4 files changed

+153
-47
lines changed

4 files changed

+153
-47
lines changed

dist/textAngular-sanitize.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,13 @@ var START_TAG_REGEXP =
168168
BEGIN_TAG_REGEXP = /^</,
169169
BEGING_END_TAGE_REGEXP = /^<\//,
170170
COMMENT_REGEXP = /<!--(.*?)-->/g,
171+
SINGLE_COMMENT_REGEXP = /(^<!--.*?-->)/,
171172
DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i,
172173
CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g,
173174
SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
174175
// Match everything outside of normal chars and " (quote character)
175-
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
176+
NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g,
177+
WHITE_SPACE_REGEXP = /^(\s+)/;
176178

177179

178180
// Good source of info about elements and attributes
@@ -288,14 +290,23 @@ function htmlParser(html, handler) {
288290
// Make sure we're not in a script or style element
289291
if (!stack.last() || !specialElements[ stack.last() ]) {
290292

291-
// Comment
292-
if (html.indexOf("<!--") === 0) {
293-
// comments containing -- are not allowed unless they terminate the comment
294-
index = html.indexOf("--", 4);
293+
// White space
294+
if (WHITE_SPACE_REGEXP.test(html)) {
295+
match = html.match(WHITE_SPACE_REGEXP);
295296

296-
if (index >= 0 && html.lastIndexOf("-->", index) === index) {
297-
if (handler.comment) handler.comment(html.substring(4, index));
298-
html = html.substring(index + 3);
297+
if (match) {
298+
var mat = match[0];
299+
if (handler.whitespace) handler.whitespace(match[0]);
300+
html = html.replace(match[0], '');
301+
chars = false;
302+
}
303+
//Comment
304+
} else if (SINGLE_COMMENT_REGEXP.test(html)) {
305+
match = html.match(SINGLE_COMMENT_REGEXP);
306+
307+
if (match) {
308+
if (handler.comment) handler.comment(match[1]);
309+
html = html.replace(match[0], '');
299310
chars = false;
300311
}
301312
// DOCTYPE
@@ -587,6 +598,12 @@ function htmlSanitizeWriter(buf, uriValidator) {
587598
out(unary ? '/>' : '>');
588599
}
589600
},
601+
comment: function (com) {
602+
out(com);
603+
},
604+
whitespace: function (ws) {
605+
out(encodeEntities(ws));
606+
},
590607
end: function(tag) {
591608
tag = angular.lowercase(tag);
592609
if (!ignore && validElements[tag] === true) {

dist/textAngular-sanitize.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)