Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: Source/devtools/front_end/common/utilities.js

Issue 539353004: DevTools: [Documentation] Update parser for WikiText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments addressed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt; ").replace(/"/g, "&quot;"); //" doublequotes just for editor 166 return this.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt; ").replace(/"/g, "&quot;"); //" 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(/&lt;/g, "<")
175 .replace(/&gt;/g, ">")
lushnikov 2014/09/12 06:39:28 lets indent this with 4 spaces instead of aligning
iliia 2014/09/12 08:46:41 Done.
176 .replace(/&#58;/g, ":")
177 .replace(/&quot;/g, "\"")
178 .replace(/&#60;/g, "<")
179 .replace(/&#62;/g, ">")
180 .replace(/&amp;/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
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 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698