vendor/assets/javascripts/unstable/angular-sanitize.js in angularjs-rails-1.2.16 vs vendor/assets/javascripts/unstable/angular-sanitize.js in angularjs-rails-1.2.18

- old
+ new

@@ -1,7 +1,7 @@ /** - * @license AngularJS v1.3.0-beta.5 + * @license AngularJS v1.3.0-beta.13 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; @@ -40,11 +40,11 @@ /** * @ngdoc service * @name $sanitize - * @function + * @kind function * * @description * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are * then serialized back to properly escaped html string. This means that no unsafe input can make * it into the returned string, however, since our parser is more strict than a typical browser @@ -164,10 +164,11 @@ BEGIN_TAG_REGEXP = /^</, BEGING_END_TAGE_REGEXP = /^<\s*\//, COMMENT_REGEXP = /<!--(.*?)-->/g, DOCTYPE_REGEXP = /<!DOCTYPE([^>]*?)>/i, CDATA_REGEXP = /<!\[CDATA\[(.*?)]]>/g, + SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, // Match everything outside of normal chars and " (quote character) NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g; // Good source of info about elements and attributes @@ -402,10 +403,15 @@ * @returns {string} escaped text */ function encodeEntities(value) { return value. replace(/&/g, '&amp;'). + replace(SURROGATE_PAIR_REGEXP, function (value) { + var hi = value.charCodeAt(0); + var low = value.charCodeAt(1); + return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; + }). replace(NON_ALPHANUMERIC_REGEXP, function(value){ return '&#' + value.charCodeAt(0) + ';'; }). replace(/</g, '&lt;'). replace(/>/g, '&gt;'); @@ -474,10 +480,10 @@ /* global sanitizeText: false */ /** * @ngdoc filter * @name linky - * @function + * @kind function * * @description * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and * plain email address links. *