OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 if (!linkText) | 170 if (!linkText) |
171 linkText = url; | 171 linkText = url; |
172 classes = (classes ? classes + " " : ""); | 172 classes = (classes ? classes + " " : ""); |
173 classes += isExternal ? "webkit-html-external-link" : "webkit-html-resource- link"; | 173 classes += isExternal ? "webkit-html-external-link" : "webkit-html-resource- link"; |
174 | 174 |
175 var a = createElement("a"); | 175 var a = createElement("a"); |
176 var href = sanitizeHref(url); | 176 var href = sanitizeHref(url); |
177 if (href !== null) | 177 if (href !== null) |
178 a.href = href; | 178 a.href = href; |
179 a.className = classes; | 179 a.className = classes; |
180 if (typeof tooltipText === "undefined") | 180 if (!tooltipText && linkText !== url) |
181 a.title = url; | 181 a.title = url; |
182 else if (typeof tooltipText !== "string" || tooltipText.length) | 182 else if (tooltipText && tooltipText.length) |
dgozman
2015/08/12 17:19:34
Just |if (tooltipText)| since empty string evaluat
samli
2015/08/17 00:53:26
Done.
| |
183 a.title = tooltipText; | 183 a.title = tooltipText; |
184 a.textContent = linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDispl ayedURLs); | 184 a.textContent = linkText.trimMiddle(WebInspector.Linkifier.MaxLengthForDispl ayedURLs); |
185 if (isExternal) | 185 if (isExternal) |
186 a.setAttribute("target", "_blank"); | 186 a.setAttribute("target", "_blank"); |
187 | 187 |
188 return a; | 188 return a; |
189 } | 189 } |
190 | 190 |
191 /** | 191 /** |
192 * @param {string} article | 192 * @param {string} article |
(...skipping 26 matching lines...) Expand all Loading... | |
219 /** | 219 /** |
220 * @param {!WebInspector.NetworkRequest} request | 220 * @param {!WebInspector.NetworkRequest} request |
221 * @return {!Element} | 221 * @return {!Element} |
222 */ | 222 */ |
223 WebInspector.linkifyRequestAsNode = function(request) | 223 WebInspector.linkifyRequestAsNode = function(request) |
224 { | 224 { |
225 var anchor = WebInspector.linkifyURLAsNode(request.url); | 225 var anchor = WebInspector.linkifyURLAsNode(request.url); |
226 anchor.requestId = request.requestId; | 226 anchor.requestId = request.requestId; |
227 return anchor; | 227 return anchor; |
228 } | 228 } |
OLD | NEW |