Chromium Code Reviews| 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) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 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 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3100 valueElement.normalize(); | 3100 valueElement.normalize(); |
| 3101 return valueElement; | 3101 return valueElement; |
| 3102 }, | 3102 }, |
| 3103 | 3103 |
| 3104 /** | 3104 /** |
| 3105 * @param {string} url | 3105 * @param {string} url |
| 3106 * @return {!Node} | 3106 * @return {!Node} |
| 3107 */ | 3107 */ |
| 3108 _processURL: function(url) | 3108 _processURL: function(url) |
| 3109 { | 3109 { |
| 3110 var hrefUrl = url; | 3110 if (url.length >= 2 && (url[0] == "\"" && url[url.length - 1] == "\"") | | (url[0] == "'" && url[url.length - 1] == "'")) |
|
lushnikov
2016/05/25 18:27:11
1. ===
2. You can use template strings to avoid qu
dgozman
2016/05/25 20:19:19
Done.
| |
| 3111 var match = hrefUrl.match(/['"]?([^'"]+)/); | 3111 url = url.substring(1, url.length - 1); |
| 3112 if (match) | |
| 3113 hrefUrl = match[1]; | |
| 3114 var container = createDocumentFragment(); | 3112 var container = createDocumentFragment(); |
| 3115 container.createTextChild("url("); | 3113 container.createTextChild("url("); |
| 3114 var hrefUrl = url; | |
| 3116 if (this._rule && this._rule.resourceURL()) | 3115 if (this._rule && this._rule.resourceURL()) |
| 3117 hrefUrl = WebInspector.ParsedURL.completeURL(this._rule.resourceURL( ), hrefUrl); | 3116 hrefUrl = WebInspector.ParsedURL.completeURL(this._rule.resourceURL( ), hrefUrl); |
| 3118 else if (this._node) | 3117 else if (this._node) |
| 3119 hrefUrl = this._node.resolveURL(hrefUrl); | 3118 hrefUrl = this._node.resolveURL(hrefUrl); |
| 3120 var hasResource = hrefUrl && !!WebInspector.resourceForURL(hrefUrl); | 3119 var hasResource = hrefUrl && !!WebInspector.resourceForURL(hrefUrl); |
| 3121 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI. | 3120 // FIXME: WebInspector.linkifyURLAsNode() should really use baseURI. |
| 3122 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl || url, url, undefined, !hasResource)); | 3121 container.appendChild(WebInspector.linkifyURLAsNode(hrefUrl || url, url, undefined, !hasResource)); |
| 3123 container.createTextChild(")"); | 3122 container.createTextChild(")"); |
| 3124 return container; | 3123 return container; |
| 3125 } | 3124 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 3138 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); | 3137 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); |
| 3139 onNodeChanged(); | 3138 onNodeChanged(); |
| 3140 return button; | 3139 return button; |
| 3141 | 3140 |
| 3142 function onNodeChanged() | 3141 function onNodeChanged() |
| 3143 { | 3142 { |
| 3144 var node = WebInspector.context.flavor(WebInspector.DOMNode); | 3143 var node = WebInspector.context.flavor(WebInspector.DOMNode); |
| 3145 button.setEnabled(!!node); | 3144 button.setEnabled(!!node); |
| 3146 } | 3145 } |
| 3147 } | 3146 } |
| OLD | NEW |