From 1b7ddd5894c2636618e630f44b1bb7d598d29b48 Mon Sep 17 00:00:00 2001 From: Mica White Date: Sat, 3 Oct 2026 14:14:31 -0400 Subject: Planning for 0.2 --- src/diagnostics.rs | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'src/diagnostics.rs') diff --git a/src/diagnostics.rs b/src/diagnostics.rs index d2db96b..295de94 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -6,6 +6,8 @@ use crate::{ tokenize::{AttributeToken, Token, TokenType}, }; +mod deprecated_attributes; +mod deprecated_tag; mod duplicate_attribute_names; mod empty_tag_name; mod end_tag_with_attributes; @@ -25,12 +27,6 @@ mod unclosed_start_tag; mod unterminated_comment; mod unterminated_tag; -const VOID_TAGS: &[&str] = &[ - "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", - "track", "wbr", "import", -]; -const ALLOWED_TOP_LEVEL_TAGS: &[&str] = &["import", "const", "block", "head", "body"]; - pub struct DiagnosticsContext { source_code: &'static str, } @@ -194,6 +190,8 @@ pub fn run_token_diagnostics(ctx: &DiagnosticsContext, tokens: &[Token<'_>]) -> ctx, tokens, ) .is_none(); + // TODO allow the AST diagnostics to still run if this fails + has_failed |= run_token_diagnostic::(ctx, tokens).is_none(); // TODO invalid character reference (!has_failed).then_some(()) } @@ -221,8 +219,29 @@ pub fn run_ast_diagnostics(ctx: &DiagnosticsContext, document: &Document<'_>) -> // TODO invalid // TODO invalid // TODO invalid - // TODO deprecated tag + // TODO invalid // TODO deprecated tag attribute + // TODO warning-only obsolete features + // TODO invalid name on anchor + // TODO invalid language on script + // TODO invalid type on style + // TODO base without href or target + // TODO multiple base elements + // TODO base target with a newline, tab, or < + // TODO invalid cite on
or + // TODO non html1 tag or attribute + // TODO empty, missing, or invalid image src + // TODO invalid form enctype + // TODO invalid form action + // TODO invalid form method + // TODO input without name + // TODO invalid input attributes for type + // TODO invalid select size + // TODO invalid select mutliple attribute + // TODO select without name + // TODO invalid option selected attribute + // TODO invalid cols and rows attributes for textarea + // TODO textarea without name // // TODO forbidden tag in noscript // TODO head tag outside head @@ -244,6 +263,20 @@ pub fn run_ast_diagnostics(ctx: &DiagnosticsContext, document: &Document<'_>) -> // TODO select inside select // TODO input, keygen, textarea inside select // TODO caption, table, tbody, tfoot, thread, tr, td, th inside select + // TODO more than one body + // TODO invalid head child + // TODO missing title + // TODO title outside head + // TODO warning for title longer than 64 characters + // TODO warning for more than one

+ // TODO invalid heading hierarchy + // TODO invalid

,

, 
, or content + // TODO wrap on
+	// TODO address inside address
+	// TODO heading inside addres
+	// TODO 
or