13

I'm still learning the ropes of JavaScript, and someone pointed out the Image object to me. Having never heard of it, I'd love to look up the specs about what it's supposed to do. This made me realize that I have no idea where to find specs for JavaScript!

Can anyone point me to whatever is the accepted specs for JavaScript? Is it just the ECMA standard at http://www.ecma-international.org/publications/standards/Ecma-262.htm ? If so, I searched there for the word "Image" and didn't come up with anything useful.

Scott Mermelstein
  • 15,174
  • 4
  • 48
  • 76
  • 1
    Here are two links from MDN about the Image object I found pretty useful. [https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement) [https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement.Image](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement.Image) – aevange Jan 30 '14 at 21:26
  • 1
    In case you're still confused (or for others) The Image object is part of the Document Object Model (DOM) spec, not Javascript. It is not part of the Javascript language. – Ash Mar 07 '14 at 03:13
  • This is exactly what you want http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-17701901 I know this is not all inclusive but this is the standard out of the w3c Also see https://developer.mozilla.org/en-US/docs/DOM/HTMLImageElement for the Mozilla standard implementation – Daniel Williams Mar 05 '13 at 20:36
  • Thanks, that is just what I was asking for. Looking at the DOM spec, I see there are a lot of object definitions. Does this mean I can create new objects of any of those types in all implementations in JavaScript? What made me wonder was seeing a line of code such as `var img = new window.Image()`. I suppose I can also do `var anc = new window.Anchor()` if I wanted? – Scott Mermelstein Mar 05 '13 at 20:52
  • I believe not all elements have explicit constructors like Image(). The normal way to create an element for the DOM is document.createElement see http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document – Daniel Williams Mar 05 '13 at 20:57
  • I guess my question should've been - is there a specification of elements that do have explicit constructors? I was surprised when I saw that line of code, and wanted to be sure it will work in all browsers. – Scott Mermelstein Mar 05 '13 at 21:01
  • I've never seen a complete list of all of them but this looks like a good starting point. I think mostly they are legacy constructors. http://stackoverflow.com/questions/6936071/where-are-constructors-such-as-new-image-and-new-option-documented – Daniel Williams Mar 05 '13 at 21:06
  • Looking through that, that's exactly what I wanted to ask! Thanks for your great replies. – Scott Mermelstein Mar 05 '13 at 21:15

0 Answers0