@@ -65,6 +65,19 @@ class PSelectorVoidTask {
6565 transpose ( ) {
6666 }
6767}
68+
69+ class PSelectorContentTask {
70+ constructor ( task ) {
71+ this . selector = task [ 1 ] ;
72+ }
73+ transpose ( node , output ) {
74+ const root = node . content ;
75+ if ( typeof root ?. querySelectorAll !== 'function' ) { return ; }
76+ const nodes = root . querySelectorAll ( this . selector ) ;
77+ output . push ( ...nodes ) ;
78+ }
79+ }
80+
6881class PSelectorHasTextTask {
6982 constructor ( task ) {
7083 this . needle = regexFromString ( task [ 1 ] ) ;
@@ -238,6 +251,7 @@ class PSelector {
238251 }
239252}
240253PSelector . prototype . operatorToTaskMap = new Map ( [
254+ [ 'content' , PSelectorContentTask ] ,
241255 [ 'has' , PSelectorIfTask ] ,
242256 [ 'has-text' , PSelectorHasTextTask ] ,
243257 [ 'if' , PSelectorIfTask ] ,
@@ -329,7 +343,7 @@ htmlFilteringEngine.compile = function(parser, writer) {
329343 // Only exception filters are allowed to be global.
330344 if ( parser . hasOptions ( ) === false ) {
331345 if ( isException ) {
332- writer . push ( [ 64 , '' , 1 , compiled ] ) ;
346+ writer . push ( [ 64 , '' , `- ${ compiled } ` ] ) ;
333347 }
334348 return ;
335349 }
0 commit comments