@@ -52,6 +52,7 @@ import {dict, getValueForExpr} from '../../../src/core/types/object';
52
52
import { getMode } from '../../../src/mode' ;
53
53
import { getSourceOrigin , isAmpScriptUri } from '../../../src/url' ;
54
54
55
+ import { escapeCssSelectorIdent } from '../../../src/core/dom/css' ;
55
56
import { isAmp4Email } from '../../../src/format' ;
56
57
import { isArray , toArray } from '../../../src/core/types/array' ;
57
58
import { isExperimentOn } from '../../../src/experiments' ;
@@ -322,12 +323,12 @@ export class AmpList extends AMP.BaseElement {
322
323
/**
323
324
* A "diffable placeholder" is the child container <div> (which is usually created by the amp-list
324
325
* to hold the rendered children). It serves the same purpose as a placeholder, except it can be diffed.
325
- *
326
+ *
326
327
* For example:
327
328
* <amp-list>
328
329
* <div placeholder>I'm displayed before render.</div>
329
330
* </amp-list>
330
- *
331
+ *
331
332
* <amp-list diffable>
332
333
* <div role=list>I'm displayed before render.</div>
333
334
* </amp-list>
@@ -336,11 +337,16 @@ export class AmpList extends AMP.BaseElement {
336
337
* @private
337
338
*/
338
339
queryDiffablePlaceholder_ ( ) {
339
- const roleSelector = this . element . hasAttribute ( 'single-item' ) ? '' : '[role=list]'
340
+ const roleSelector = this . element . hasAttribute ( 'single-item' )
341
+ ? ''
342
+ : '[role=list]' ;
343
+
340
344
return scopedQuerySelector (
341
345
this . element ,
342
346
// Don't select other special <div> children used for placeholders/fallback/etc.
343
- `> div${ roleSelector } :not([placeholder]):not([fallback]):not([fetch-error])`
347
+ `> div${ escapeCssSelectorIdent (
348
+ roleSelector
349
+ ) } :not([placeholder]):not([fallback]):not([fetch-error])`
344
350
) ;
345
351
}
346
352
0 commit comments