O'Reilly logo

JavaScript® Bible, Seventh Edition by Paul Novitski, Danny Goodman, Tia Gustaff Rayl, Michael Morrison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 26. Generic HTML Element Objects

IN THIS CHAPTER

  • Working with HTML element objects

  • Common properties and methods

  • Event handlers of all element objects

The object model specifications implemented in Internet Explorer 4+ and W3C (Mozilla-based and WebKit-based) browsers feature a large set of scriptable objects that represent what we often call generic HTML elements. Generic elements can be divided into two groups. One group, such as the band strike elements, defines font styles to be applied to enclosed sequences of text. The need for these elements (and the objects that represent them) is all but gone due to more page designers using style sheets. The second group of elements assigns context to content within their start and end tags. Examples of contextual elements include h1, blockquote, and the ubiquitous p element. Although browsers sometimes have consistent visual ways of rendering contextual elements by default (for example, the large bold font of an <h1> tag), the specific rendering is not the intended purpose of the tags. No formal standard dictates that text within an em element must be italicized: The style simply has become the custom since the very early days of browsers.

All of these generic elements share a large number of scriptable properties, methods, and event handlers. The sharing extends not only among generic elements, but also among virtually every renderable element—even if it has additional, element-specific properties, methods, and/or event handlers that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required