-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add slot=selected-value support for <selectmenu>
We decided to support this in OpenUI: openui/open-ui#657 (comment) This patch also adds a test for ::part(selected-value) which as far as I can tell was not tested before. Bug: 1121840 Change-Id: I90b18d12249872239bd41e1be460ed46176fd17b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4220472 Auto-Submit: Joey Arhar <[email protected]> Reviewed-by: Xiaocheng Hu <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1102933}
- Loading branch information
1 parent
53ecf5b
commit d7059c0
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
html/semantics/forms/the-selectmenu-element/selectmenu-selected-value-behavior-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<script src="support/fake-selectmenu.js"></script> | ||
<body> | ||
<script> | ||
const selectmenu = createFakeSelectmenu('hello world'); | ||
document.body.appendChild(selectmenu); | ||
selectmenu.querySelector('.fake-selectmenu-selected-value') | ||
.style.color = 'blue'; | ||
</script> |
8 changes: 8 additions & 0 deletions
8
.../semantics/forms/the-selectmenu-element/selectmenu-selected-value-behavior.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=match href="selectmenu-selected-value-behavior-ref.html"> | ||
|
||
<selectmenu> | ||
<div style="color:blue" slot=selected-value behavior=selected-value></div> | ||
<option>hello world</option> | ||
</selectmenu> |
9 changes: 9 additions & 0 deletions
9
html/semantics/forms/the-selectmenu-element/selectmenu-selected-value-part-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<script src="support/fake-selectmenu.js"></script> | ||
<body> | ||
<script> | ||
const selectmenu = createFakeSelectmenu('hello world'); | ||
document.body.appendChild(selectmenu); | ||
selectmenu.querySelector('.fake-selectmenu-selected-value') | ||
.style.backgroundColor = 'red'; | ||
</script> |
12 changes: 12 additions & 0 deletions
12
html/semantics/forms/the-selectmenu-element/selectmenu-selected-value-part.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=match href="selectmenu-selected-value-part-ref.html"> | ||
|
||
<style> | ||
selectmenu::part(selected-value) { | ||
background-color: red; | ||
} | ||
</style> | ||
<selectmenu> | ||
<option>hello world</option> | ||
</selectmenu> |
14 changes: 14 additions & 0 deletions
14
html/semantics/forms/the-selectmenu-element/selectmenu-selected-value-slot-ref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<script src="support/fake-selectmenu.js"></script> | ||
<body> | ||
<script> | ||
const selectmenu = createFakeSelectmenu('hello world'); | ||
document.body.appendChild(selectmenu); | ||
|
||
const oldSelectedValue = selectmenu.querySelector('.fake-selectmenu-selected-value'); | ||
const newSelectedValue = document.createElement('div'); | ||
newSelectedValue.textContent = 'new selected value'; | ||
|
||
const button = selectmenu.querySelector('.fake-selectmenu-internal-selectmenu-button'); | ||
button.replaceChild(newSelectedValue, oldSelectedValue); | ||
</script> |
8 changes: 8 additions & 0 deletions
8
html/semantics/forms/the-selectmenu-element/selectmenu-selected-value-slot.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE html> | ||
<link rel=author href="mailto:[email protected]"> | ||
<link rel=match href="selectmenu-selected-value-slot-ref.html"> | ||
|
||
<selectmenu> | ||
<div slot=selected-value>new selected value</div> | ||
<option>hello world</option> | ||
</selectmenu> |