|
237 | 237 | _transformHostSelector: function(selector, hostScope) {
|
238 | 238 | var m = selector.match(HOST_PAREN);
|
239 | 239 | var paren = m && m[2].trim() || '';
|
240 |
| - if (paren && !paren[0].match(SIMPLE_SELECTOR_PREFIX)) { |
241 |
| - // paren starts with a type selector |
242 |
| - var typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0]; |
243 |
| - // if the type selector is our hostScope then avoid pre-pending it |
244 |
| - if (typeSelector === hostScope) { |
245 |
| - return paren; |
246 |
| - // otherwise, this selector should not match in this scope so |
247 |
| - // output a bogus selector. |
| 240 | + if (paren) { |
| 241 | + if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) { |
| 242 | + // paren starts with a type selector |
| 243 | + var typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0]; |
| 244 | + // if the type selector is our hostScope then avoid pre-pending it |
| 245 | + if (typeSelector === hostScope) { |
| 246 | + return paren; |
| 247 | + // otherwise, this selector should not match in this scope so |
| 248 | + // output a bogus selector. |
| 249 | + } else { |
| 250 | + return SELECTOR_NO_MATCH; |
| 251 | + } |
248 | 252 | } else {
|
249 |
| - return SELECTOR_NO_MATCH; |
| 253 | + return hostScope + paren; |
250 | 254 | }
|
| 255 | + // if no paren, do a straight :host replacement. |
| 256 | + // TODO(sorvell): this should not strictly be necessary but |
| 257 | + // it's needed to maintain support for `:host[foo]` type selectors |
| 258 | + // which have been improperly used under Shady DOM. This should be |
| 259 | + // deprecated. |
| 260 | + } else { |
| 261 | + return selector.replace(HOST, hostScope); |
251 | 262 | }
|
252 |
| - return hostScope + paren; |
253 | 263 | },
|
254 | 264 |
|
255 | 265 | documentRule: function(rule) {
|
|
0 commit comments