-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Conversation
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
estelle
requested review from
sideshowbarker
and removed request for
a team
September 21, 2024 03:35
github-actions
bot
added
Content:WebAPI
Web API docs
size/m
[PR only] 51-500 LoC changed
labels
Sep 21, 2024
Preview URLs (6 pages)(comment last updated: 2024-09-28 05:34:01) |
Josh-Cena
reviewed
Sep 21, 2024
Josh-Cena
reviewed
Sep 23, 2024
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>`. |
There was a problem hiding this comment.
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/selectedindex/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Joshua Chen <[email protected]>
Josh-Cena
approved these changes
Sep 28, 2024
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
part of #35544