Image() constructor?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Genisio

    Image() constructor?

    Hey all,

    I am trying to figure out what the constructors for the Image object are.

    I have figured out that in IE and Mozilla, the Image object, and the
    HTMLImageElemen t are the same, from a property perspective at least, but
    what is the constructor for the Image object?

    I know that I can call the following constructors, but are there others?

    Image()
    Image(int x, int y)

    I could not find any actual spec for this.

    Brian

  • Brian Genisio

    #2
    Re: Image() constructor?

    Brian Genisio wrote:
    [color=blue]
    > Hey all,
    >
    > I am trying to figure out what the constructors for the Image object are.
    >
    > I have figured out that in IE and Mozilla, the Image object, and the
    > HTMLImageElemen t are the same, from a property perspective at least, but
    > what is the constructor for the Image object?
    >
    > I know that I can call the following constructors, but are there others?
    >
    > Image()
    > Image(int x, int y)
    >
    > I could not find any actual spec for this.
    >
    > Brian
    >[/color]


    Well, I found this...


    It says that the constructor is :

    Image([width,] [height]);

    But, this is a page claiming to be an ECMAScript reference, though the
    ECMAScript spec does not talk about images... it is browser thing... so
    I do not trust this reference.

    Any other ideas?
    Brian

    Comment

    • Martin Honnen

      #3
      Re: Image() constructor?



      Brian Genisio wrote:

      [color=blue]
      > I am trying to figure out what the constructors for the Image object are.[/color]

      Well, if you write Image() (as you do in the subject) then you are
      probably talking about a constructor function itself, that available in
      client side JavaScript for the purpose of image preloading since Netscape 3:



      In general, for host objects, don't expect constructor functions to be
      exposed at all or the same in all browsers.

      And nowadays, with DOM supporting browser, if you want to create an
      <img> element object use document.create Element('img') as
      document.create Element is a factory function to create any element from
      its tagname.

      --

      Martin Honnen


      Comment

      • Brian Genisio

        #4
        Re: Image() constructor?

        Martin Honnen wrote:
        [color=blue]
        >
        >
        > Brian Genisio wrote:
        >
        >[color=green]
        >> I am trying to figure out what the constructors for the Image object are.[/color]
        >
        >
        > Well, if you write Image() (as you do in the subject) then you are
        > probably talking about a constructor function itself, that available in
        > client side JavaScript for the purpose of image preloading since
        > Netscape 3:
        >
        > http://devedge.netscape.com/library/...nce/image.html
        >[/color]


        Yeah, that is what I am looking for. I am implementing a DOM, so I
        need to make sure the Image() constructor is avaialable to the user, and
        I wanted to make sure I was not missing any constructor capabilities.
        [color=blue]
        >
        > In general, for host objects, don't expect constructor functions to be
        > exposed at all or the same in all browsers.
        >[/color]

        In that case, I will assume the ([width,] [height]) constructor... that
        should be safe. Any other constructor the user would use, I would not
        need to support.
        [color=blue]
        > And nowadays, with DOM supporting browser, if you want to create an
        > <img> element object use document.create Element('img') as
        > document.create Element is a factory function to create any element from
        > its tagname.
        >[/color]

        My DOM supports document.create Element('img') already, so I am cool there.

        Thanks,
        Brian

        Comment

        Working...