public static function provideSerializeStringValue() {
return [
[ 'Hello World!', '"Hello World!"' ],
- [ "Null\0Null", "\"Null\\fffd Null\"" ],
+ [ "Null\0Null", "\"Null\u{FFFD}Null\"" ],
[ '"', '"\\""' ],
[ "'", '"\'"' ],
[ "\\", '"\\\\"' ],
[ "Space tab \t space", '"Space tab \\9 space"' ],
[ "Line\nfeed", '"Line\\a feed"' ],
[ "Return\rreturn", '"Return\\d return"' ],
- [ "Next\xc2\x85line", "\"Next\xc2\x85line\"" ],
+ [ "Next\u{0085}line", "\"Next\u{0085}line\"" ],
[ "Del\x7fDel", '"Del\\7f Del"' ],
- [ "nb\xc2\xa0sp", "\"nb\xc2\xa0sp\"" ],
+ [ "nb\u{00A0}sp", "\"nb\u{00A0}sp\"" ],
[ "AMP&AMP", "\"AMP&AMP\"" ],
[ '!"#$%&\'()*+,-./0123456789:;<=>?', '"!\\"#$%&\'()*+,-./0123456789:;<=>?"' ],
[ '@[\\]^_`{|}~', '"@[\\\\]^_`{|}~"' ],
[ true, '//example.org/x.y.z/image.png' ],
[ true, '//localhost/styles.css?query=yes' ],
[ true, 'data:image/gif;base64,R0lGODlhAQABAIAAAP8AADAAACwAAAAAAQABAAACAkQBADs=' ],
+ [ false, '' ],
+ [ false, '/' ],
+ [ true, '//' ],
[ false, 'x.gif' ],
[ false, '/x.gif' ],
[ false, './x.gif' ],
public static function provideIsLocalUrls() {
return [
+ [ false, '' ],
+ [ false, '/' ],
+ [ false, '//' ],
[ false, 'x.gif' ],
[ true, '/x.gif' ],
[ false, './x.gif' ],
[ 'background-image: url("");', false, '/example', false ],
'background-image: url("");',
],
+ 'Single quote with outer spacing' => [
+ [ "background-image: url( '' );", false, '/example', false ],
+ "background-image: url( '' );",
+ ],
];
}
'foo { background: url(/static/foo.png?query=yes); }',
'foo { background: url(https://expand.example/static/foo.png?query=yes); }',
],
+ [
+ 'Path-relative URL with query',
+ "foo { background: url(?query=yes); }",
+ 'foo { background: url(http://localhost/w/?query=yes); }',
+ ],
[
'Remote URL (unnecessary quotes not preserved)',
'foo { background: url("http://example.org/w/unnecessary-quotes.png"); }',
'foo { background: url( "http://localhost/styles.css?quoted=double" ) }',
'foo { background: url(http://localhost/styles.css?quoted=double) }',
],
+ [
+ 'Background URL (single quoted, containing spaces, with outer spacing)',
+ "foo { background: url( ' red.gif ' ); }",
+ 'foo { background: url("http://localhost/w/ red.gif "); }',
+ ],
[
'Simple case with comments before url',
'foo { prop: /* some {funny;} comment */ url(bar.png); }',