Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New pages: htmloptionscollection #35982

Merged
merged 9 commits into from
Sep 28, 2024
Merged

New pages: htmloptionscollection #35982

merged 9 commits into from
Sep 28, 2024

Conversation

estelle
Copy link
Member

@estelle estelle commented Sep 21, 2024

part of #35544

@estelle estelle requested a review from a team as a code owner September 21, 2024 03:35
@estelle estelle requested review from sideshowbarker and removed request for a team September 21, 2024 03:35
@github-actions github-actions bot added Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed labels Sep 21, 2024
@estelle estelle requested a review from Josh-Cena September 23, 2024 17:04
files/en-us/web/api/htmloptionscollection/add/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/htmloptionscollection/add/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/htmloptionscollection/add/index.md Outdated Show resolved Hide resolved
Comment on lines 13 to 17
By default, the `add()` appends the {{HTMLelement("option")}} or {{HTMLelement("optgroup")}} passed as the parameter to the end of the collection. You can define where the added `<option>` or `<optgroup>` should be placed by specifying the `before` parameter. The `before` is the `<option>` element or a numeric `0`-based index of the `<option>` element the added element should precede.

If the `before` parameter is null or out of range (or omitted), the `<option>` or `<optgroup>` will be appended as the last element in the collection, outside of any {{HTMLelement("optgroup")}}. If the `<option>` referenced by the `before` parameter is in an {{HTMLelement("optgroup")}}, an added `HTMLOptionElement` will be in the same group.

The `<optgroup>` element can only contain `<option>` elements as child nodes. The `add()` method will successfully add an `HTMLOptGroupElement` to the end of the `HTMLOptionsCollection` or between `<optgroup>` elements only. In other words, attempting to add an `HTMLOptGroupElement` before an `<option>` within an `<optgroup>` may silently if the `<option>` referenced by the `before` parameter is not the first `<option>` within its `<optgroup>`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put these three paragraphs in a separate "description" section, I recommend

files/en-us/web/api/htmloptionscollection/add/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/htmloptionscollection/length/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/htmloptionscollection/remove/index.md Outdated Show resolved Hide resolved
files/en-us/web/api/htmloptionscollection/remove/index.md Outdated Show resolved Hide resolved
@estelle estelle requested a review from Josh-Cena September 26, 2024 17:26
@Josh-Cena Josh-Cena merged commit a5e089d into main Sep 28, 2024
9 checks passed
@Josh-Cena Josh-Cena deleted the optcollect branch September 28, 2024 05:34
fiji-flo pushed a commit that referenced this pull request Oct 2, 2024
* New pages: htmloptionscollection

* remove refect word

* Apply suggestions from code review

Co-authored-by: Joshua Chen <[email protected]>

* edits per review

* Update index.md

* Update files/en-us/web/api/htmloptionscollection/selectedindex/index.md

---------

Co-authored-by: Joshua Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants