OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 * @return {string} | 162 * @return {string} |
163 */ | 163 */ |
164 String.prototype.escapeHTML = function() | 164 String.prototype.escapeHTML = function() |
165 { | 165 { |
166 return this.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">
").replace(/"/g, """); //" doublequotes just for editor | 166 return this.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">
").replace(/"/g, """); //" doublequotes just for editor |
167 } | 167 } |
168 | 168 |
169 /** | 169 /** |
170 * @return {string} | 170 * @return {string} |
171 */ | 171 */ |
| 172 String.prototype.unescapeHTML = function() |
| 173 { |
| 174 return this.replace(/</g, "<") |
| 175 .replace(/>/g, ">") |
| 176 .replace(/:/g, ":") |
| 177 .replace(/"/g, "\"") |
| 178 .replace(/</g, "<") |
| 179 .replace(/>/g, ">") |
| 180 .replace(/&/g, "&"); |
| 181 } |
| 182 |
| 183 /** |
| 184 * @return {string} |
| 185 */ |
172 String.prototype.collapseWhitespace = function() | 186 String.prototype.collapseWhitespace = function() |
173 { | 187 { |
174 return this.replace(/[\s\xA0]+/g, " "); | 188 return this.replace(/[\s\xA0]+/g, " "); |
175 } | 189 } |
176 | 190 |
177 /** | 191 /** |
178 * @param {number} maxLength | 192 * @param {number} maxLength |
179 * @return {string} | 193 * @return {string} |
180 */ | 194 */ |
181 String.prototype.trimMiddle = function(maxLength) | 195 String.prototype.trimMiddle = function(maxLength) |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 var cbList = callbacks.slice(); | 1752 var cbList = callbacks.slice(); |
1739 callbacks.length = 0; | 1753 callbacks.length = 0; |
1740 cbList.forEach(function(callback) { callback(); }); | 1754 cbList.forEach(function(callback) { callback(); }); |
1741 }; | 1755 }; |
1742 return function setImmediate(callback) { | 1756 return function setImmediate(callback) { |
1743 if (!callbacks.length) | 1757 if (!callbacks.length) |
1744 new Promise(function(resolve,reject){ resolve(null);}).then(run); | 1758 new Promise(function(resolve,reject){ resolve(null);}).then(run); |
1745 callbacks.push(callback); | 1759 callbacks.push(callback); |
1746 }; | 1760 }; |
1747 })(); | 1761 })(); |
OLD | NEW |