@@ -185,6 +185,68 @@ test('raw', function (t) {
185185 'should not discard HTML broken over several raw nodes'
186186 )
187187
188+ t . deepEqual (
189+ raw ( u ( 'root' , [ u ( 'custom' , 'x' ) ] ) , { passThrough : [ 'custom' ] } ) ,
190+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , 'x' ) ] ) ,
191+ 'should support passing through nodes w/o children'
192+ )
193+
194+ t . deepEqual (
195+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'raw' , '<i>j</i>' ) ] ) ] ) , {
196+ passThrough : [ 'custom' ]
197+ } ) ,
198+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ h ( 'i' , 'j' ) ] ) ] ) ,
199+ 'should support passing through nodes w/ `raw` children'
200+ )
201+
202+ t . deepEqual (
203+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'comment' , 'x' ) ] ) ] ) , {
204+ passThrough : [ 'custom' ]
205+ } ) ,
206+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ u ( 'comment' , 'x' ) ] ) ] ) ,
207+ 'should support passing through nodes w/ `comment` children'
208+ )
209+
210+ t . deepEqual (
211+ raw ( u ( 'root' , [ u ( 'custom' , [ ] ) ] ) , {
212+ passThrough : [ 'custom' ]
213+ } ) ,
214+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ ] ) ] ) ,
215+ 'should support passing through nodes w/ `0` children'
216+ )
217+
218+ t . deepEqual (
219+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'raw' , '<x' ) ] ) ] ) , {
220+ passThrough : [ 'custom' ]
221+ } ) ,
222+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ ] ) ] ) ,
223+ 'should support passing through nodes w/ broken raw children (1)'
224+ )
225+
226+ t . deepEqual (
227+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'raw' , '<x>' ) ] ) ] ) , {
228+ passThrough : [ 'custom' ]
229+ } ) ,
230+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ h ( 'x' ) ] ) ] ) ,
231+ 'should support passing through nodes w/ broken raw children (2)'
232+ )
233+
234+ t . deepEqual (
235+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'raw' , '</x>' ) ] ) ] ) , {
236+ passThrough : [ 'custom' ]
237+ } ) ,
238+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ ] ) ] ) ,
239+ 'should support passing through nodes w/ broken raw children (3)'
240+ )
241+
242+ t . deepEqual (
243+ raw ( u ( 'root' , [ u ( 'custom' , [ u ( 'raw' , '<x>' ) ] ) , u ( 'raw' , '</x>' ) ] ) , {
244+ passThrough : [ 'custom' ]
245+ } ) ,
246+ u ( 'root' , { data : { quirksMode : false } } , [ u ( 'custom' , [ h ( 'x' ) ] ) ] ) ,
247+ 'should support passing through nodes w/ broken raw children (4)'
248+ )
249+
188250 t . deepEqual (
189251 raw ( u ( 'root' , [ u ( 'raw' , '<script>alert(1)</script>' ) ] ) ) ,
190252 u ( 'root' , { data : { quirksMode : false } } , [
0 commit comments