summaryrefslogtreecommitdiff
path: root/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/diagnostics.rs')
-rw-r--r--src/diagnostics.rs48
1 files changed, 40 insertions, 8 deletions
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::<deprecated_tag::DeprectatedTag>(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 <import />
// TODO invalid <const />
// TODO invalid <block />
- // TODO deprecated tag
+ // TODO invalid <kuht-http />
// 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 <blockquote> or <q>
+ // 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 <h1>
+ // TODO invalid heading hierarchy
+ // TODO invalid <p>, <pre>, <address>, <cite> or <h_> content
+ // TODO wrap on <pre>
+ // TODO address inside address
+ // TODO heading inside addres
+ // TODO <header> or <footer> inside <address>
+ // TODO section content (<article>, <aside>, <section>, <nav>) inside address
+ // TODO image map outside <a>
//
// TODO anchor with invalid href
// TODO dt or dd outside dl
@@ -251,7 +284,6 @@ pub fn run_ast_diagnostics(ctx: &DiagnosticsContext, document: &Document<'_>) ->
// TODO invalid dl, ul, menu
// TODO invalid attribute values (see microsyntaxes)
// TODO aria tags don't match tag semantics
- // TODO empty or missing image src
// TODO missing alt text for image (unless inside figure with caption, or has title, or meta name = "generator")
(!has_failed).then_some(())
}