| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * @param {string} url | 73 * @param {string} url |
| 74 * @param {string=} displayText | 74 * @param {string=} displayText |
| 75 * @param {boolean=} allowExternalNavigation | 75 * @param {boolean=} allowExternalNavigation |
| 76 * @return {!Element} | 76 * @return {!Element} |
| 77 */ | 77 */ |
| 78 url: function(url, displayText, allowExternalNavigation) | 78 url: function(url, displayText, allowExternalNavigation) |
| 79 { | 79 { |
| 80 var a = createElement("a"); | 80 return WebInspector.createAnchor(url, displayText, !allowExternalNavigat
ion); |
| 81 a.href = sanitizeHref(url); | |
| 82 a.title = url; | |
| 83 a.textContent = displayText || url; | |
| 84 if (allowExternalNavigation) | |
| 85 a.target = "_blank"; | |
| 86 return a; | |
| 87 }, | 81 }, |
| 88 | 82 |
| 89 /** | 83 /** |
| 90 * @param {string} url | 84 * @param {string} url |
| 91 * @param {number=} line | 85 * @param {number=} line |
| 92 * @return {!Element} | 86 * @return {!Element} |
| 93 */ | 87 */ |
| 94 resourceLink: function(url, line) | 88 resourceLink: function(url, line) |
| 95 { | 89 { |
| 96 // FIXME: use WebInspector.Linkifier | 90 // FIXME: use WebInspector.Linkifier |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 { | 138 { |
| 145 if (value instanceof Array) | 139 if (value instanceof Array) |
| 146 return value.map(this.partiallyApply.bind(this, formatters, thisArgu
ment)); | 140 return value.map(this.partiallyApply.bind(this, formatters, thisArgu
ment)); |
| 147 if (typeof value === "object" && typeof formatters[value.type] === "func
tion" && value.arguments) | 141 if (typeof value === "object" && typeof formatters[value.type] === "func
tion" && value.arguments) |
| 148 return formatters[value.type].apply(thisArgument, value.arguments); | 142 return formatters[value.type].apply(thisArgument, value.arguments); |
| 149 return value; | 143 return value; |
| 150 } | 144 } |
| 151 } | 145 } |
| 152 | 146 |
| 153 WebInspector.auditFormatters = new WebInspector.AuditFormatters(); | 147 WebInspector.auditFormatters = new WebInspector.AuditFormatters(); |
| OLD | NEW |