LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 { | 199 { |
200 sub = sub.trim(); | 200 sub = sub.trim(); |
201 | 201 |
202 qualifiedSelector += ", "; | 202 qualifiedSelector += ", "; |
203 | 203 |
204 let index = findTargetSelectorIndex(sub); | 204 let index = findTargetSelectorIndex(sub); |
205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substring(index))
; | 205 let [, type = "", rest] = /^([a-z][a-z-]*)?(.*)/i.exec(sub.substring(index))
; |
206 | 206 |
207 // Note that the first group in the regular expression is optional. If it | 207 // Note that the first group in the regular expression is optional. If it |
208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string. | 208 // doesn't match (e.g. "#foo::nth-child(1)"), type will be an empty string. |
209 qualifiedSelector += sub.substring(0, index) + type + qualifier + rest; | 209 // If `rest` is "*" then it is discarded. |
| 210 qualifiedSelector += sub.substring(0, index) + type + qualifier + |
| 211 (rest != "*" ? rest : ""); |
210 } | 212 } |
211 | 213 |
212 // Remove the initial comma and space. | 214 // Remove the initial comma and space. |
213 return qualifiedSelector.substring(2); | 215 return qualifiedSelector.substring(2); |
214 } | 216 } |
215 | 217 |
216 exports.qualifySelector = qualifySelector; | 218 exports.qualifySelector = qualifySelector; |
LEFT | RIGHT |