{"record":{"id":"1f65ea8302ac2977","repo":"swc-project/swc","slug":"non-void-html-element-start-tag-with-trailing-soli","errorCode":null,"errorMessage":"Non void html element start tag with trailing solidus","messagePattern":"Non void html element start tag with trailing solidus","errorType":"exception","errorClass":"swc_html_parser::error::Error","httpStatus":null,"severity":"error","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":572,"sourceCode":"\n            // Re-emit errors from tokenizer\n            for error in self.input.take_errors() {\n                let (span, kind) = *error.into_inner();\n\n                self.errors.push(Error::new(span, kind));\n            }\n\n            self.tree_construction_dispatcher(&mut token_and_info)?;\n\n            // When a start tag token is emitted with its self-closing flag set,\n            // if the flag is not acknowledged when it is processed by the tree\n            // construction stage, that is a parse error.\n            if let Token::StartTag {\n                is_self_closing, ..\n            } = &token_and_info.token\n            {\n                if *is_self_closing && !token_and_info.acknowledged {\n                    self.errors.push(Error::new(\n                        token_and_info.span,\n                        ErrorKind::NonVoidHtmlElementStartTagWithTrailingSolidus,\n                    ));\n                }\n            }\n        }\n\n        Ok(())\n    }\n\n    fn tree_construction_dispatcher(&mut self, token_and_info: &mut TokenAndInfo) -> PResult<()> {\n        // As each token is emitted from the tokenizer, the user agent must follow the\n        // appropriate steps from the following list, known as the tree construction\n        // dispatcher:\n        //\n        // If the stack of open elements is empty\n        //\n        // If the adjusted current node is an element in the HTML namespace","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L554-L590","documentation":"HTML parse error raised in the parser loop after tree construction: a StartTag token carried the self-closing flag (trailing '/') but the element is not a void element, so per spec the flag is not acknowledged and the solidus is reported as an error. Parsing continues with normal start-tag handling.","triggerScenarios":"Thrown at crates/swc_html_parser/src/parser/mod.rs:572 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the trailing '/' from non-void element start tags (e.g. <div/> -> <div>)","Use proper <element>...</element> form for non-void elements"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5176682b65416c6b5de6b47379ae1588ea3ecb3f","analyzedAt":"2026-08-17T16:16:52.067Z","contentChangedAt":"2026-08-17T16:16:52.067Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}