vendor/assets/javascripts/angular-sanitize.js in angularjs-rails-1.3.10 vs vendor/assets/javascripts/angular-sanitize.js in angularjs-rails-1.3.14
- old
+ new
@@ -1,7 +1,7 @@
/**
- * @license AngularJS v1.3.10
+ * @license AngularJS v1.3.14
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
@@ -274,18 +274,18 @@
} else {
html = '' + html;
}
}
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) {
// comments containing -- are not allowed unless they terminate the comment
index = html.indexOf("--", 4);
@@ -339,11 +339,12 @@
if (handler.chars) handler.chars(decodeEntities(text));
}
} 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");
if (handler.chars) handler.chars(decodeEntities(text));
@@ -363,21 +364,21 @@
// Clean up any remaining tags
parseEndTag();
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)
stack.push(tagName);
var attrs = {};
@@ -398,49 +399,36 @@
var pos = 0, i;
tagName = angular.lowercase(tagName);
if (tagName)
// Find the closest opened tag of the same type
for (pos = stack.length - 1; pos >= 0; pos--)
- if (stack[ pos ] == tagName)
+ 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;
}
}
}
var hiddenPre=document.createElement("pre");
-var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
/**
* decodes all entities into regular string
* @param value
* @returns {string} A string with decoded entities.
*/
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;
}
/**
* Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or