From d2b6fd34e4098ba526567c23fe2ee9f66473e84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= <188768+fb55@users.noreply.github.com> Date: Fri, 20 May 2022 10:23:43 +0100 Subject: [PATCH 1/3] Add tests to increase spec coverage parse5 is now tracking the test coverage of its codebase. The tests here all cover areas that previously didn't have tests. --- tree-construction/doctype01.dat | 45 ++++++++++++++++++++++++++++++++- tree-construction/tables01.dat | 12 +++++++++ tree-construction/tests2.dat | 10 ++++++++ tree-construction/tests4.dat | 16 ++++++++++++ tree-construction/tests7.dat | 36 ++++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 1 deletion(-) diff --git a/tree-construction/doctype01.dat b/tree-construction/doctype01.dat index 9efdaf70..99c71326 100644 --- a/tree-construction/doctype01.dat +++ b/tree-construction/doctype01.dat @@ -368,14 +368,17 @@ #data +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

#errors (2,54): unknown-doctype +(2,64): eof-in-table #document | | | | +|

+|

#data | | + +#data +

+#errors +(1,83): unknown-doctype +(1,93): eof-in-table +#document +| +| +| +| +|

+|

+ +#data +

+#errors +(1,30): unknown-doctype +(1,39): eof-in-table +#document +| +| +| +| +|

+|

+ +#data +

+#errors +(2,43): unknown-doctype +(2,53): eof-in-table +#document +| +| +| +| +|

+|

diff --git a/tree-construction/tables01.dat b/tree-construction/tables01.dat index f0caaa3c..20d2f50e 100644 --- a/tree-construction/tables01.dat +++ b/tree-construction/tables01.dat @@ -284,3 +284,15 @@ | | | + +#data +
a +#errors +(1,7): expected-doctype-but-got-start-tag +(1,30): expected-closing-tag-but-got-eof +#document +| +| +| +| "a" +|
diff --git a/tree-construction/tests2.dat b/tree-construction/tests2.dat index b44fec4d..11ef9b16 100644 --- a/tree-construction/tests2.dat +++ b/tree-construction/tests2.dat @@ -584,6 +584,16 @@ | | +#data + +#errors +Line: 1 Col: 31 Unexpected DOCTYPE. Ignored. +#document +| +| +| +| + #data test test diff --git a/tree-construction/tests4.dat b/tree-construction/tests4.dat index 0a6174c3..4f0cf70e 100644 --- a/tree-construction/tests4.dat +++ b/tree-construction/tests4.dat @@ -56,3 +56,19 @@ head #document | | "setting head's innerHTML" + +#data +direct <title> content +#errors +#document-fragment +title +#document +| "direct <title> content" + +#data +<!-- inside </script> --> +#errors +#document-fragment +script +#document +| "<!-- inside </script> -->" diff --git a/tree-construction/tests7.dat b/tree-construction/tests7.dat index 8c5596b0..b2db4de1 100644 --- a/tree-construction/tests7.dat +++ b/tree-construction/tests7.dat @@ -46,6 +46,42 @@ | "X" | <body> +#data +<!doctype html></head><base>X +#errors +(1,28): unexpected-start-tag-out-of-my-head +#document +| <!DOCTYPE html> +| <html> +| <head> +| <base> +| <body> +| "X" + +#data +<!doctype html></head><basefont>X +#errors +(1,32): unexpected-start-tag-out-of-my-head +#document +| <!DOCTYPE html> +| <html> +| <head> +| <basefont> +| <body> +| "X" + +#data +<!doctype html></head><bgsound>X +#errors +(1,31): unexpected-start-tag-out-of-my-head +#document +| <!DOCTYPE html> +| <html> +| <head> +| <bgsound> +| <body> +| "X" + #data <!doctype html><table><meta></table> #errors From 154fe8314f904ed162f47ddf8d762132d350e9c2 Mon Sep 17 00:00:00 2001 From: Felix <188768+fb55@users.noreply.github.com> Date: Sat, 25 Mar 2023 22:55:37 +0100 Subject: [PATCH 2/3] Create quirks01.dat --- tree-construction/doctype01.dat | 45 +--------------------------- tree-construction/quirks01.dat | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 44 deletions(-) create mode 100644 tree-construction/quirks01.dat diff --git a/tree-construction/doctype01.dat b/tree-construction/doctype01.dat index 99c71326..9efdaf70 100644 --- a/tree-construction/doctype01.dat +++ b/tree-construction/doctype01.dat @@ -368,17 +368,14 @@ #data <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" -"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><p><table> +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> #errors (2,54): unknown-doctype -(2,64): eof-in-table #document | <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> | <html> | <head> | <body> -| <p> -| <table> #data <!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] "uri" [ @@ -475,43 +472,3 @@ | <html> | <head> | <body> - -#data -<!DOCTYPE html SYSTEM "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"><p><table> -#errors -(1,83): unknown-doctype -(1,93): eof-in-table -#document -| <!DOCTYPE html "" "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"> -| <html> -| <head> -| <body> -| <p> -| <table> - -#data -<!DOCTYPE html PUBLIC "html"><p><table> -#errors -(1,30): unknown-doctype -(1,39): eof-in-table -#document -| <!DOCTYPE html "html" ""> -| <html> -| <head> -| <body> -| <p> -| <table> - -#data -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN" - "http://www.w3.org/TR/html4/strict.dtd"><p><table> -#errors -(2,43): unknown-doctype -(2,53): eof-in-table -#document -| <!DOCTYPE html "-//W3C//DTD HTML 3.2//EN" "http://www.w3.org/TR/html4/strict.dtd"> -| <html> -| <head> -| <body> -| <p> -| <table> diff --git a/tree-construction/quirks01.dat b/tree-construction/quirks01.dat new file mode 100644 index 00000000..bc58de5c --- /dev/null +++ b/tree-construction/quirks01.dat @@ -0,0 +1,53 @@ +#data +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><p><table> +#errors +(2,54): unknown-doctype +(2,64): eof-in-table +#document +| <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> +| <html> +| <head> +| <body> +| <p> +| <table> + +#data +<!DOCTYPE html SYSTEM "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"><p><table> +#errors +(1,83): unknown-doctype +(1,93): eof-in-table +#document +| <!DOCTYPE html "" "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"> +| <html> +| <head> +| <body> +| <p> +| <table> + +#data +<!DOCTYPE html PUBLIC "html"><p><table> +#errors +(1,30): unknown-doctype +(1,39): eof-in-table +#document +| <!DOCTYPE html "html" ""> +| <html> +| <head> +| <body> +| <p> +| <table> + +#data +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN" + "http://www.w3.org/TR/html4/strict.dtd"><p><table> +#errors +(2,43): unknown-doctype +(2,53): eof-in-table +#document +| <!DOCTYPE html "-//W3C//DTD HTML 3.2//EN" "http://www.w3.org/TR/html4/strict.dtd"> +| <html> +| <head> +| <body> +| <p> +| <table> From 2c1b556de0ddd1c262cdcecc432fbf19ffc28989 Mon Sep 17 00:00:00 2001 From: Felix Boehm <188768+fb55@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:01:35 +0100 Subject: [PATCH 3/3] Update tables01.dat Co-authored-by: Mike Dalessio <mike.dalessio@gmail.com> --- tree-construction/tables01.dat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tree-construction/tables01.dat b/tree-construction/tables01.dat index b63d111f..aa7915eb 100644 --- a/tree-construction/tables01.dat +++ b/tree-construction/tables01.dat @@ -310,8 +310,10 @@ #data <table>a<!doctype html> #errors -(1,7): expected-doctype-but-got-start-tag -(1,30): expected-closing-tag-but-got-eof +(1,1): expected-doctype-but-got-start-tag +(1,8): illegal-character-token +(1,9): illegal-doctype +(1,24): expected-closing-tag-but-got-eof #document | <html> | <head>