Style nit

Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
This commit is contained in:
stevennovaryo 2025-05-30 01:21:16 +08:00
parent 9d469fc917
commit 8ede3509ca
6 changed files with 87 additions and 7 deletions

View file

@ -1,10 +1,10 @@
/* We should use `content-visibility` but it is yet to be implemented.
* These rule would not comply with ::details-content and should be removed
* with it's implementation */
slot[id="internal-contents-slot"] {
slot#internal-contents-slot {
display: none;
}
:host([open]) slot[id="internal-contents-slot"] {
:host([open]) slot#internal-contents-slot {
display: block;
}

View file

@ -104,7 +104,7 @@ impl HTMLDetailsElement {
.expect("UA shadow tree was not created")
}
/// <https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements>
/// <https://html.spec.whatwg.org/multipage/#the-details-and-summary-elements>
fn create_shadow_tree(&self, can_gc: CanGc) {
let document = self.owner_document();
let root = self
@ -163,7 +163,8 @@ impl HTMLDetailsElement {
.AppendChild(descendants_slot.upcast::<Node>(), can_gc)
.unwrap();
// > 3. The third child element is either a link or style element with the following styles for the default summary:
// > 3. The third child element is either a link or style element with the following
// > styles for the default summary:
let link_element = HTMLLinkElement::new(
local_name!("link"),
None,
@ -191,7 +192,6 @@ impl HTMLDetailsElement {
);
link_element.set_stylesheet(details_stylesheet.unwrap());
let _ = self.shadow_tree.borrow_mut().insert(ShadowTree {
summary_slot: summary_slot.as_traced(),
descendants_slot: descendants_slot.as_traced(),
@ -220,7 +220,9 @@ impl HTMLDetailsElement {
for child in self.upcast::<Node>().children() {
if let Some(element) = child.downcast::<Element>() {
// Assign the first summary element to the summary slot.
if element.local_name() == &local_name!("summary") && !discovered_first_summary_element {
if element.local_name() == &local_name!("summary") &&
!discovered_first_summary_element
{
shadow_tree
.summary_slot
.Assign(vec![ElementOrText::Element(DomRoot::from_ref(element))]);
@ -242,7 +244,7 @@ impl HTMLDetailsElement {
shadow_tree
.summary_slot
.Assign(vec![ElementOrText::Element(DomRoot::upcast(
shadow_tree.fallback_summary.as_rooted()
shadow_tree.fallback_summary.as_rooted(),
))]);
}
}

View file

@ -352512,6 +352512,19 @@
{}
]
],
"details-content-security-policy.html": [
"2e98d81e31420d43dcdff110dd3703c5a2e9ddb4",
[
"html/rendering/the-details-element/details-content-security-policy.html",
[
[
"/html/rendering/the-details-element/single-summary.html",
"=="
]
],
{}
]
],
"details-display-type-001-ref.html": [
"925ee19f775fd07ac6e679598329d05f609e5335",
[
@ -352551,6 +352564,19 @@
{}
]
],
"details-multiple-summaries.html": [
"55829ce57bc1cf12109ac2d553fa93a86b4422b4",
[
"html/rendering/the-details-element/details-multiple-summaries.html",
[
[
"/html/rendering/the-details-element/details-multiple-summaries-ref.html",
"=="
]
],
{}
]
],
"details-pseudo-elements-001.html": [
"f9d48101fb65edfc868a67a5722cdbfc0e8f7f1b",
[
@ -480162,6 +480188,10 @@
"297634b521fab5e61d0bbac9edb4480b5de7366d",
[]
],
"details-multiple-summaries-ref.html": [
"a23296880c15e3578f1428f0ca51073fc49df6c2",
[]
],
"details-pseudo-elements-001-ref.html": [
"0c77c0e14fc3e0f3707e6dee32aea5a9738b6fb1",
[]

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'none';">
<link rel="author" title="Jo Steven Novaryo" href="mailto:steven.novaryo@gmail.com">
<title>Details Element Appearance Should not be Affected By Content Security Policy</title>
<link rel="match" href="single-summary.html">
</head>
<details>
<summary>This is the main summary</summary>
This is the content
</details>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Details Element Should not Discard the Additional Summary Element</title>
</head>
<style>
#main-summary {
display: list-item;
list-style: disclosure-open inside;
}
</style>
<div>
<summary id="main-summary">This is the main summary</summary>
<summary>This is the additional summary</summary>
This is the content
</div>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Details Element Should not Discard the Additional Summary Element</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements">
<link rel="match" href="details-multiple-summaries-ref.html">
<link rel="author" title="Jo Steven Novaryo" href="mailto:steven.novaryo@gmail.com">
</head>
<details open>
<summary>This is the main summary</summary>
<summary id="second-summary">This is the additional summary</summary>
This is the content
</details>