#112 ✓resolved
nickg

Option "selectedness" needs tests

Reported by nickg | March 15th, 2010 @ 11:56 AM

Like "Image", "Option" is the other weirdo in the DOM that has a constructor.

$ ./tester.sh
Rhino 1.7 release 2 2009 03 22
js> Option
js: "<stdin>", line 2: uncaught JavaScript runtime exception: ReferenceError: "Option" is not defined.
    at <stdin>:2

In my original envjs-like thing I did something like the following. I don't this will work the same in envjs, but it gives an idea of the solution.

// Can free form create Option elements                                                                                                          
// who knew!                                                                                                                                     
Option = function(name,value) {
    var tmp= window.document.createElement('option');
    this._dom = tmp._dom;
    this.label = String(name);
    if (value) {
        this.value = String(value);
        this.text = String(value);
    }

    //print("MADE OPTION OF " + name + ", " + value);                                                                                            
    this.__init();
}
Option.prototype = HTMLOptionElement.prototype;

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

a javascript browser environment

People watching this ticket

Pages