Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion moli-renderer-v8/src/runtime/markdown_dump/visibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ impl<'a, D: MarkdownSource> MarkdownDom<'a, D> {
// A clean textarea gets its default from child text, not the
// control-state slot (which is initially empty). Once dirty,
// even an empty live value is authoritative.
// Range and color always sanitize a value; export it only when
// the author supplied one, as the sanitized `.value` reports.
let authored_control =
matches!(element.input_type(), InputType::Range | InputType::Color);
matches!(element.input_type(), InputType::Range | InputType::Color)
&& element.attribute("value").is_none_or(str::is_empty);
if (element.is_html_input() && !authored_control) || element.input_value_dirty() {
attribute_overrides
.entry(node)
Expand Down
5 changes: 4 additions & 1 deletion moli-renderer-v8/src/runtime/page_vm/tests/markdown_dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,10 @@ async fn markdown_live_structure_and_visibility_have_exact_outputs() {
("<h1><span style='display:inline-block'>H</span><span style='display:inline-block'>i</span></h1>", "# Hi"),
("<span style='display:inline-flex'>1</span><span style='display:inline-block'>2</span>", "12"),
("<label>Volume <input type=range value=''></label> <input type=color value=''>", "Volume"),
("<input type=range value='abc'> <input type=color value='invalid'>", "abc invalid"),
("<input type=range value='abc'> <input type=color value='invalid'>", "50 #000000"),
("<label>Volume <input type=range value=150></label> <input type=color value='#FF0000'>", "Volume 100 #ff0000"),
("<video style='display:none'><source src='/hidden.webm'></video><p>Body <source src='/stray.webm'>text</p><picture><source srcset='/p.webp'><img src='/p.png' alt='Pic'></picture>", "Body text\n\n![Pic](https://example.test/p.png)"),
("<video controls><source src='/a.webm'><source src='/a.mp4'>Sorry, no video.</video><audio controls><source src='/b.ogg'></audio>", "[Video](https://example.test/a.webm) [Video](https://example.test/a.mp4)\n\n[Audio](https://example.test/b.ogg)"),
("<div style='display:flex;flex-direction:column'><span>A</span><span>B</span></div>", "A\n\nB"),
("<p><span style='display:block'>A</span><span style='display:block'>B</span></p>", "A\n\nB"),
("<span style='display:inline-block'>Active</span> <span style='display:inline-block'>Reviewed</span>", "Active Reviewed"),
Expand Down
2 changes: 1 addition & 1 deletion moli-renderer-v8/src/style_engine/ua/html.css
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ h6 {
}

base, basefont, datalist, head, link, meta, noembed, noframes, param, rp,
script, style, template, title, source {
script, style, template, title {
display: none;
}

Expand Down
Loading