Exemplo n.º 1
0
  public static void build(State s) {
    CONSTRUCTOR =
        new ObjectLabel(DOMObjects.HTMLBASEELEMENT_CONSTRUCTOR, ObjectLabel.Kind.FUNCTION);
    PROTOTYPE = new ObjectLabel(DOMObjects.HTMLBASEELEMENT_PROTOTYPE, ObjectLabel.Kind.OBJECT);
    INSTANCES = new ObjectLabel(DOMObjects.HTMLBASEELEMENT_INSTANCES, ObjectLabel.Kind.OBJECT);

    // Constructor Object
    s.newObject(CONSTRUCTOR);
    s.writePropertyWithAttributes(
        CONSTRUCTOR, "length", Value.makeNum(0).setAttributes(true, true, true));
    s.writePropertyWithAttributes(
        CONSTRUCTOR, "prototype", Value.makeObject(PROTOTYPE).setAttributes(true, true, true));
    s.writeInternalPrototype(CONSTRUCTOR, Value.makeObject(InitialStateBuilder.OBJECT_PROTOTYPE));
    s.writeProperty(DOMWindow.WINDOW, "HTMLBaseElement", Value.makeObject(CONSTRUCTOR));

    // Prototype Object
    s.newObject(PROTOTYPE);
    s.writeInternalPrototype(PROTOTYPE, Value.makeObject(HTMLElement.ELEMENT_PROTOTYPE));

    // Multiplied Object
    s.newObject(INSTANCES);
    s.writeInternalPrototype(INSTANCES, Value.makeObject(PROTOTYPE));

    /*
     * Properties.
     */
    // DOM LEVEL 1
    createDOMProperty(s, INSTANCES, "href", Value.makeAnyStr());
    createDOMProperty(s, INSTANCES, "target", Value.makeAnyStr());

    s.multiplyObject(INSTANCES);
    INSTANCES = INSTANCES.makeSingleton().makeSummary();

    /*
     * Functions.
     */
    // No functions.
  }