| 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 25 matching lines...) Expand all Loading... |
| 36 } | 36 } |
| 37 | 37 |
| 38 WebInspector.AuditFormatters.Registry = { | 38 WebInspector.AuditFormatters.Registry = { |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * @param {string} text | 41 * @param {string} text |
| 42 * @return {!Text} | 42 * @return {!Text} |
| 43 */ | 43 */ |
| 44 text: function(text) | 44 text: function(text) |
| 45 { | 45 { |
| 46 return document.createTextNode(text); | 46 return createTextNode(text); |
| 47 }, | 47 }, |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * @param {string} snippetText | 50 * @param {string} snippetText |
| 51 * @return {!Element} | 51 * @return {!Element} |
| 52 */ | 52 */ |
| 53 snippet: function(snippetText) | 53 snippet: function(snippetText) |
| 54 { | 54 { |
| 55 var div = document.createElement("div"); | 55 var div = createElement("div"); |
| 56 div.textContent = snippetText; | 56 div.textContent = snippetText; |
| 57 div.className = "source-code"; | 57 div.className = "source-code"; |
| 58 return div; | 58 return div; |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @return {!Element} | 62 * @return {!Element} |
| 63 */ | 63 */ |
| 64 concat: function() | 64 concat: function() |
| 65 { | 65 { |
| 66 var parent = document.createElement("span"); | 66 var parent = createElement("span"); |
| 67 for (var arg = 0; arg < arguments.length; ++arg) | 67 for (var arg = 0; arg < arguments.length; ++arg) |
| 68 parent.appendChild(WebInspector.auditFormatters.apply(arguments[arg]
)); | 68 parent.appendChild(WebInspector.auditFormatters.apply(arguments[arg]
)); |
| 69 return parent; | 69 return parent; |
| 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 = document.createElement("a"); | 80 var a = createElement("a"); |
| 81 a.href = sanitizeHref(url); | 81 a.href = sanitizeHref(url); |
| 82 a.title = url; | 82 a.title = url; |
| 83 a.textContent = displayText || url; | 83 a.textContent = displayText || url; |
| 84 if (allowExternalNavigation) | 84 if (allowExternalNavigation) |
| 85 a.target = "_blank"; | 85 a.target = "_blank"; |
| 86 return a; | 86 return a; |
| 87 }, | 87 }, |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * @param {string} url | 90 * @param {string} url |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 { | 144 { |
| 145 if (value instanceof Array) | 145 if (value instanceof Array) |
| 146 return value.map(this.partiallyApply.bind(this, formatters, thisArgu
ment)); | 146 return value.map(this.partiallyApply.bind(this, formatters, thisArgu
ment)); |
| 147 if (typeof value === "object" && typeof formatters[value.type] === "func
tion" && value.arguments) | 147 if (typeof value === "object" && typeof formatters[value.type] === "func
tion" && value.arguments) |
| 148 return formatters[value.type].apply(thisArgument, value.arguments); | 148 return formatters[value.type].apply(thisArgument, value.arguments); |
| 149 return value; | 149 return value; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 | 152 |
| 153 WebInspector.auditFormatters = new WebInspector.AuditFormatters(); | 153 WebInspector.auditFormatters = new WebInspector.AuditFormatters(); |
| OLD | NEW |