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

Add Options() to HTMLSelectElement. #13

Closed
dmitshur opened this issue Dec 1, 2014 · 1 comment
Closed

Add Options() to HTMLSelectElement. #13

dmitshur opened this issue Dec 1, 2014 · 1 comment
Assignees

Comments

@dmitshur
Copy link
Collaborator

dmitshur commented Dec 1, 2014

I think it would be useful if HTMLSelectElement had Options() just like HTMLDataListElement does (which is where I copied the code from):

diff --git a/dom.go b/dom.go
index 78f3e2e..a2fa6e7 100644
--- a/dom.go
+++ b/dom.go
@@ -2401,6 +2401,15 @@ type HTMLScriptElement struct {

 type HTMLSelectElement struct{ *BasicHTMLElement }

+func (e *HTMLSelectElement) Options() []*HTMLOptionElement {
+   options := nodeListToElements(e.Get("options"))
+   out := make([]*HTMLOptionElement, len(options))
+   for i, option := range options {
+       out[i] = option.(*HTMLOptionElement)
+   }
+   return out
+}
+
 type HTMLSourceElement struct {
    *BasicHTMLElement
    Media string `js:"media"`
@dominikh
Copy link
Owner

dominikh commented Dec 1, 2014

You are right. HTMLSelectELement has generally not been implemented yet, which is why it doesn't have any fields or methods yet. I will add those soon.

@dominikh dominikh self-assigned this Dec 1, 2014
dmitshur added a commit to shurcooL/frontend that referenced this issue Mar 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants