jQuery in Action

50
CHAPTER 3
Bringing pages to life with jQuery
create the JavaScript object that represents this element in the
DOM
. In addition
to storing the attributes, this object possesses a number of properties, including
some that represent the values of the markup attributes (and even one that main-
tains the list of the attributes themselves). Figure 3.1 shows a simplified overview
of this process.
The
HTML
markup is translated by the browser into a
DOM
element that rep-
resents the image. A
NodeList
object (one of the container types defined by the
DOM
) is created and assigned as a property of the element named
attributes
.
There is a dynamic association between the attributes and their corresponding
properties (which we'll refer to as attribute properties). Changing an attribute
results in a change in the corresponding attribute property and vice versa. Even
so, the values may not always be identical. For example, setting the
src
attribute
of the image element to
image.gif
will result in the
src
property being set to the
full absolute
URL
of the image.
Figure 3.1 HTML markup is translated into DOM elements, including the attributes of the tag and
the properties created from them.


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.