@@ -331,53 +331,45 @@ public function test_parse_attribute(
331331 */
332332 public static function data_attribute_selectors (): array {
333333 return array (
334- '[href] ' => array ( '[href] ' , 'href ' , null , null , null , '' ),
335- '[href] type ' => array ( '[href] type ' , 'href ' , null , null , null , ' type ' ),
336- '[href]#id ' => array ( '[href]#id ' , 'href ' , null , null , null , '#id ' ),
337- '[href].class ' => array ( '[href].class ' , 'href ' , null , null , null , '.class ' ),
338- '[href][href2] ' => array ( '[href][href2] ' , 'href ' , null , null , null , '[href2] ' ),
339- '[\n href\t\r] ' => array ( "[ \n href \t\r] " , 'href ' , null , null , null , '' ),
340- '[href=foo] ' => array ( '[href=foo] ' , 'href ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'foo ' , null , '' ),
341- '[href \n = bar ] ' => array ( "[href \n = bar ] " , 'href ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'bar ' , null , '' ),
342- '[href \n ^= baz ] ' => array ( "[href \n ^= baz ] " , 'href ' , WP_CSS_Attribute_Selector::MATCH_PREFIXED_BY , 'baz ' , null , '' ),
343-
344- '[match $= insensitive i] ' => array ( '[match $= insensitive i] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY , 'insensitive ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
345- '[match|=sensitive s] ' => array ( '[match|=sensitive s] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_EXACT_OR_EXACT_WITH_HYPHEN , 'sensitive ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
346- '[att=val I] ' => array ( '[att=val I] ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'val ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
347- '[att=val S] ' => array ( '[att=val S] ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'val ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
348-
349- '[match~="quoted[][]"] ' => array ( '[match~="quoted[][]"] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_ONE_OF_EXACT , 'quoted[][] ' , null , '' ),
350- "[match$='quoted!{}'] " => array ( "[match$='quoted!{}'] " , 'match ' , WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY , 'quoted!{} ' , null , '' ),
351- "[match*='quoted's] " => array ( "[match*='quoted's] " , 'match ' , WP_CSS_Attribute_Selector::MATCH_CONTAINS , 'quoted ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
352-
353- '[escape-nl="foo \\nbar"] ' => array ( "[escape-nl='foo \\\nbar'] " , 'escape-nl ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'foobar ' , null , '' ),
354- '[escape-seq=" \\31 23"] ' => array ( "[escape-seq=' \\31 23'] " , 'escape-seq ' , WP_CSS_Attribute_Selector::MATCH_EXACT , '123 ' , null , '' ),
355-
356- 'Unterminated: [att ' => array ( '[att ' , 'att ' , null , null , null , '' ),
357- 'Unterminated: [att=" ' => array ( '[att=" ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , '' , null , '' ),
358- 'Unterminated: [att=" \\" ' => array ( '[att=" \\" ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , '" ' , null , '' ),
359- 'Unterminated: [att="x" ' => array ( '[att="x" ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'x ' , null , '' ),
360- 'Unterminated: [att="x \\"i] ' => array ( '[att="x \\"i] ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'x"i] ' , null , '' ),
361- 'Unterminated: [att="x" i ' => array ( '[att="x" i ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'x ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
362- 'Unterminated: [att = x i ' => array ( '[att = x i ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'x ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
334+ '[href] ' => array ( '[href] ' , 'href ' , null , null , null , '' ),
335+ '[href] type ' => array ( '[href] type ' , 'href ' , null , null , null , ' type ' ),
336+ '[href]#id ' => array ( '[href]#id ' , 'href ' , null , null , null , '#id ' ),
337+ '[href].class ' => array ( '[href].class ' , 'href ' , null , null , null , '.class ' ),
338+ '[href][href2] ' => array ( '[href][href2] ' , 'href ' , null , null , null , '[href2] ' ),
339+ '[\n href\t\r] ' => array ( "[ \n href \t\r] " , 'href ' , null , null , null , '' ),
340+ '[href=foo] ' => array ( '[href=foo] ' , 'href ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'foo ' , null , '' ),
341+ '[href \n = bar ] ' => array ( "[href \n = bar ] " , 'href ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'bar ' , null , '' ),
342+ '[href \n ^= baz ] ' => array ( "[href \n ^= baz ] " , 'href ' , WP_CSS_Attribute_Selector::MATCH_PREFIXED_BY , 'baz ' , null , '' ),
343+
344+ '[match $= insensitive i] ' => array ( '[match $= insensitive i] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY , 'insensitive ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
345+ '[match|=sensitive s] ' => array ( '[match|=sensitive s] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_EXACT_OR_EXACT_WITH_HYPHEN , 'sensitive ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
346+ '[att=val I] ' => array ( '[att=val I] ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'val ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_INSENSITIVE , '' ),
347+ '[att=val S] ' => array ( '[att=val S] ' , 'att ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'val ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
348+
349+ '[match~="quoted[][]"] ' => array ( '[match~="quoted[][]"] ' , 'match ' , WP_CSS_Attribute_Selector::MATCH_ONE_OF_EXACT , 'quoted[][] ' , null , '' ),
350+ "[match$='quoted!{}'] " => array ( "[match$='quoted!{}'] " , 'match ' , WP_CSS_Attribute_Selector::MATCH_SUFFIXED_BY , 'quoted!{} ' , null , '' ),
351+ "[match*='quoted's] " => array ( "[match*='quoted's] " , 'match ' , WP_CSS_Attribute_Selector::MATCH_CONTAINS , 'quoted ' , WP_CSS_Attribute_Selector::MODIFIER_CASE_SENSITIVE , '' ),
352+
353+ '[escape-nl="foo \\nbar"] ' => array ( "[escape-nl='foo \\\nbar'] " , 'escape-nl ' , WP_CSS_Attribute_Selector::MATCH_EXACT , 'foobar ' , null , '' ),
354+ '[escape-seq=" \\31 23"] ' => array ( "[escape-seq=' \\31 23'] " , 'escape-seq ' , WP_CSS_Attribute_Selector::MATCH_EXACT , '123 ' , null , '' ),
363355
364356 // Invalid
365- 'Invalid: (empty string) ' => array ( '' ),
366- 'Invalid: foo ' => array ( 'foo ' ),
367- 'Invalid: [foo ' => array ( '[foo ' ),
368- 'Invalid: [#foo] ' => array ( '[#foo] ' ),
369- 'Invalid: [*|*] ' => array ( '[*|*] ' ),
370- 'Invalid: [ns|*] ' => array ( '[ns|*] ' ),
371- 'Invalid: [* |att] ' => array ( '[* |att] ' ),
372- 'Invalid: [*| att] ' => array ( '[*| att] ' ),
373- 'Invalid: [att * =] ' => array ( '[att * =] ' ),
374- 'Invalid: [att+=val] ' => array ( '[att+=val] ' ),
375- 'Invalid: [att=val ' => array ( '[att=val ' ),
376- 'Invalid: [att i] ' => array ( '[att i] ' ),
377- 'Invalid: [att s] ' => array ( '[att s] ' ),
378- "Invalid: [att='val \\n'] " => array ( "[att='val \n'] " ),
379- 'Invalid: [att=val i ' => array ( '[att=val i ' ),
380- 'Invalid: [att="val"ix ' => array ( '[att="val"ix ' ),
357+ 'Invalid: (empty string) ' => array ( '' ),
358+ 'Invalid: foo ' => array ( 'foo ' ),
359+ 'Invalid: [foo ' => array ( '[foo ' ),
360+ 'Invalid: [#foo] ' => array ( '[#foo] ' ),
361+ 'Invalid: [*|*] ' => array ( '[*|*] ' ),
362+ 'Invalid: [ns|*] ' => array ( '[ns|*] ' ),
363+ 'Invalid: [* |att] ' => array ( '[* |att] ' ),
364+ 'Invalid: [*| att] ' => array ( '[*| att] ' ),
365+ 'Invalid: [att * =] ' => array ( '[att * =] ' ),
366+ 'Invalid: [att+=val] ' => array ( '[att+=val] ' ),
367+ 'Invalid: [att=val ' => array ( '[att=val ' ),
368+ 'Invalid: [att i] ' => array ( '[att i] ' ),
369+ 'Invalid: [att s] ' => array ( '[att s] ' ),
370+ "Invalid: [att='val \\n'] " => array ( "[att='val \n'] " ),
371+ 'Invalid: [att=val i ' => array ( '[att=val i ' ),
372+ 'Invalid: [att="val"ix ' => array ( '[att="val"ix ' ),
381373 );
382374 }
383375
0 commit comments