diff options
Diffstat (limited to 'js/vendor/angular-sanitize/angular-sanitize.js')
-rw-r--r-- | js/vendor/angular-sanitize/angular-sanitize.js | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/js/vendor/angular-sanitize/angular-sanitize.js b/js/vendor/angular-sanitize/angular-sanitize.js index 72581da35..162d3d6df 100644 --- a/js/vendor/angular-sanitize/angular-sanitize.js +++ b/js/vendor/angular-sanitize/angular-sanitize.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.4.0-build.3807+sha.b3a9bd3 + * @license AngularJS v1.4.0-build.3834+sha.75725b4 * (c) 2010-2015 Google, Inc. http://angularjs.org * License: MIT */ @@ -276,14 +276,14 @@ function htmlParser(html, handler) { } } var index, chars, match, stack = [], last = html, text; - stack.last = function() { return stack[ stack.length - 1 ]; }; + stack.last = function() { return stack[stack.length - 1]; }; while (html) { text = ''; chars = true; // Make sure we're not in a script or style element - if (!stack.last() || !specialElements[ stack.last() ]) { + if (!stack.last() || !specialElements[stack.last()]) { // Comment if (html.indexOf("<!--") === 0) { @@ -341,7 +341,8 @@ function htmlParser(html, handler) { } } else { - html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), + // IE versions 9 and 10 do not understand the regex '[^]', so using a workaround with [\W\w]. + html = html.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'), function(all, text) { text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1"); @@ -365,20 +366,21 @@ function htmlParser(html, handler) { function parseStartTag(tag, tagName, rest, unary) { tagName = angular.lowercase(tagName); - if (blockElements[ tagName ]) { - while (stack.last() && inlineElements[ stack.last() ]) { + if (blockElements[tagName]) { + while (stack.last() && inlineElements[stack.last()]) { parseEndTag("", stack.last()); } } - if (optionalEndTagElements[ tagName ] && stack.last() == tagName) { + if (optionalEndTagElements[tagName] && stack.last() == tagName) { parseEndTag("", tagName); } - unary = voidElements[ tagName ] || !!unary; + unary = voidElements[tagName] || !!unary; - if (!unary) + if (!unary) { stack.push(tagName); + } var attrs = {}; @@ -397,16 +399,17 @@ function htmlParser(html, handler) { function parseEndTag(tag, tagName) { var pos = 0, i; tagName = angular.lowercase(tagName); - if (tagName) + if (tagName) { // Find the closest opened tag of the same type - for (pos = stack.length - 1; pos >= 0; pos--) - if (stack[ pos ] == tagName) - break; + for (pos = stack.length - 1; pos >= 0; pos--) { + if (stack[pos] == tagName) break; + } + } if (pos >= 0) { // Close all the open elements, up the stack for (i = stack.length - 1; i >= pos; i--) - if (handler.end) handler.end(stack[ i ]); + if (handler.end) handler.end(stack[i]); // Remove the open elements from the stack stack.length = pos; @@ -415,7 +418,6 @@ function htmlParser(html, handler) { } var hiddenPre=document.createElement("pre"); -var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/; /** * decodes all entities into regular string * @param value @@ -424,22 +426,10 @@ var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/; function decodeEntities(value) { if (!value) { return ''; } - // Note: IE8 does not preserve spaces at the start/end of innerHTML - // so we must capture them and reattach them afterward - var parts = spaceRe.exec(value); - var spaceBefore = parts[1]; - var spaceAfter = parts[3]; - var content = parts[2]; - if (content) { - hiddenPre.innerHTML=content.replace(/</g,"<"); - // innerText depends on styling as it doesn't display hidden elements. - // Therefore, it's better to use textContent not to cause unnecessary - // reflows. However, IE<9 don't support textContent so the innerText - // fallback is necessary. - content = 'textContent' in hiddenPre ? - hiddenPre.textContent : hiddenPre.innerText; - } - return spaceBefore + content + spaceAfter; + hiddenPre.innerHTML = value.replace(/</g,"<"); + // innerText depends on styling as it doesn't display hidden elements. + // Therefore, it's better to use textContent not to cause unnecessary reflows. + return hiddenPre.textContent; } /** |