Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 8. Elements > The Element Type

8.4. The Element Type

The Element type is unarguably the most important MooTools type object when it comes to DOM scripting. All element objects—both inside and outside the DOM Tree—inherit from Element.prototype and with this type object, MooTools is able to extend all elements in the page to create a better API for working with the DOM.

In the native DOM API, the Element constructor is a placeholder constructor: you can access it using its identifier, but you can't invoke it as a constructor using the new keyword. This is because the Element constructor isn't actually used for creating elements. Instead, the Element constructor is used to implement a proper prototype chain between Node and HTMLElement, which means it's used for nothing else aside from inheriting properties from Element.prototype. In fact, Internet Explorer versions prior to version 9 go the extra mile and hide the Element constructor from the DOM API, making it inaccessible from JavaScript.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial