@blazetrails/html-sanitizer
HTML sanitizer for Trails, mirroring rails-html-sanitizer
| Measure | Value |
|---|---|
| Rails counterpart | rails-html-sanitizer v1.6.2 |
| API methods matched | 63% (120 of 189) |
| Rails tests matched | 0% (0 of 192) |
| Ruby files ported | 11 |
| Ruby files unported | 7 |
| Measured at | fe89b44726 |
Gaps by file
Ported files with Rails methods or tests still missing, largest gap first.
| Ruby file | TypeScript file | Methods missing | Tests matched |
|---|---|---|---|
sanitizer.rb | sanitizer.ts | 6 | 0 / 192 |
concerns.rb | concerns.ts | 12 | — |
parser.rb | parser.ts | 9 | — |
scrubbers.rb | scrubbers.ts | 2 | — |
Missing methods
The Rails methods parity:api finds no TypeScript counterpart for, by Ruby file.
concerns.rb: 12 missing
scrub!, text, inner_text, to_str, to_text, initialize, serialize_root, parse, remove_comments_before_html_element, to_s, serialize, document_klass
parser.rb: 9 missing
consume_qualified_rule, consume_rules, create_selector, create_style_rule, parse_component_value, parse_declaration, parse_rule, parse_rules, parse_stylesheet
sanitizer.rb: 6 missing
remove_xpaths, properly_encode, full_sanitizer, link_sanitizer, safe_list_sanitizer, white_list_sanitizer
scrubbers.rb: 2 missing
remove_blank_text_nodes, scrubber_symbols
Unported Ruby files
helpers.rb(9 methods)html4/document_fragment.rb(7 methods)html4/document.rb(7 methods)html5/document_fragment.rb(7 methods)html5/document.rb(7 methods)xml/document_fragment.rb(1 methods)xml/document.rb(2 methods)
Deviation receipts
JSDoc receipt tags in the package's source, by the receipt each carries.
| Tag | PERMANENT | CONVERGEABLE | none |
|---|---|---|---|
@noRailsEquivalent | 1 | 0 | 0 |
@missingRailsCall | 0 | 1 | 0 |
@missingRailsArgs | 1 | 0 | 0 |
@internal | 0 | 0 | 37 |
Permanently skipped tests
Ratified deviations
Each rule below is ratified in the repository's CLAUDE.md files. The first paragraph is quoted; the link opens the full section at this build's commit.
A String has no encoding tag either
str.encoding, force_encoding and String#b read or change a per-object encoding. A JS string has none, and trails adds none: the carrier that would hold it is the carrier this section rejects. ruby-compat tags a Uint8Array only. A Rails body that branches on a String's encoding ports the UTF-8 arm, and a test asserting str.encoding is permanently unportable for that assertion.