{"record":{"id":"344a1d0a180affd4","repo":"swc-project/swc","slug":"non-space-character-in-frameset","errorCode":null,"errorMessage":"Non-space character in \"frameset\"","messagePattern":"Non-space character in \"frameset\"","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"crates/swc_html_parser/src/parser/mod.rs","lineNumber":6433,"sourceCode":"                                self.errors.push(Error::new(\n                                    token_and_info.span,\n                                    ErrorKind::EofWithUnclosedElements,\n                                ));\n                            }\n                            _ => {}\n                        }\n\n                        self.stopped = true;\n                    }\n                    // Anything else\n                    //\n                    // Parse error. Ignore the token.\n                    _ => match token {\n                        // Doctype handled above\n                        // Comment handled above\n                        // EOF handled above\n                        Token::Character { .. } => {\n                            self.errors.push(Error::new(\n                                token_and_info.span,\n                                ErrorKind::NonSpaceCharacterInFrameset,\n                            ));\n                        }\n                        Token::StartTag { tag_name, .. } => {\n                            self.errors.push(Error::new(\n                                token_and_info.span,\n                                ErrorKind::StrayStartTag(tag_name.clone()),\n                            ));\n                        }\n                        Token::EndTag { tag_name, .. } => {\n                            self.errors.push(Error::new(\n                                token_and_info.span,\n                                ErrorKind::StrayEndTag(tag_name.clone()),\n                            ));\n                        }\n                        _ => {\n                            unreachable!()","sourceCodeStart":6415,"sourceCodeEnd":6451,"githubUrl":"https://github.com/swc-project/swc/blob/5176682b65416c6b5de6b47379ae1588ea3ecb3f/crates/swc_html_parser/src/parser/mod.rs#L6415-L6451","documentation":"A non-whitespace character token was dispatched in the 'in frameset' insertion mode. The spec says: parse error, ignore the token — frameset content cannot hold text, so the character is dropped from the tree. NonSpaceCharacterInFrameset records the loss with the character's span.","triggerScenarios":"Visible text between frameset tags, e.g. `<frameset rows=\"*\">Your browser does not support frames</frameset>` (text directly, not inside <noframes>). The 'anything else' arm of InFrameset mode pushes the error.","commonSituations":"Fallback messages intended for non-frame browsers written directly into the frameset instead of inside <noframes>; copy-pasting body-style content into frameset layouts; legacy migration errors.","solutions":["Wrap fallback text in <noframes>...</noframes> (or a <frame src> document).","Remove stray text nodes from the frameset region entirely.","If the input is third-party, filter ErrorKind::NonSpaceCharacterInFrameset; note the text is dropped, not relocated."],"exampleFix":"<!-- before -->\n<frameset cols=\"*\">\n  Please enable frames.\n  <frame src=\"a.html\">\n</frameset>\n\n<!-- after -->\n<frameset cols=\"*\">\n  <frame src=\"a.html\">\n  <noframes>Please enable frames.</noframes>\n</frameset>","handlingStrategy":"validation","validationCode":"// Heuristic: text (not wrapped in <noframes>) inside the frameset region.\nfn has_bare_text_in_frameset(src: &str) -> bool {\n    let lower = src.to_ascii_lowercase();\n    if let (Some(s), Some(e)) = (lower.find(\"<frameset\"), lower.find(\"</frameset>\")) {\n        if e > s {\n            let region = &src[s..e];\n            // crude: strip tags, see if visible text remains\n            let mut text = String::new();\n            let mut in_tag = false;\n            for c in region.chars() {\n                match c { '<' => in_tag = true, '>' => in_tag = false, _ if !in_tag => text.push(c), _ => {} }\n            }\n            return text.chars().any(|c| !c.is_ascii_whitespace());\n        }\n    }\n    false\n}","typeGuard":"use swc_html_parser::error::{Error, ErrorKind};\n\nfn is_non_space_in_frameset(err: &Error) -> bool {\n    matches!(err.kind(), ErrorKind::NonSpaceCharacterInFrameset)\n}","tryCatchPattern":"let mut errors = Vec::new();\nlet doc = parse_file_as_document(&fm, config, &mut errors)?;\nif errors.iter().any(is_non_space_in_frameset) {\n    log::warn!(\"text inside <frameset> was dropped; use <noframes>\");\n}","preventionTips":["Put fallback text in <noframes>, never bare inside frameset.","Remember the parser DROPS this text — verify output tree, not just the error list.","When migrating body pages to framesets, prune text nodes from the frameset region."],"tags":["html","parser","swc","frameset","text-node","parse-error"],"backgroundTag":"content-in-frameset","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"}