W3C home > Mailing lists > Public > public-svg-ig@w3.org > April to June 2009

explaining baseVal and SVG DOM

From: Dailey, David P. <david.dailey@sru.edu>
Date: Fri, 10 Apr 2009 12:40:17 -0400
Message-ID: <1835D662B263BC4E864A7CFAB2FEEB3D0225D3AE@msfexch01.srunet.sruad.edu>
To: "SVG IG List" <public-svg-ig@w3.org>
In working through Erik D's comments upon the book I'm working on, he
observes how an
alternative to document.getElementById("R").getAttribute("height") might
be document.getElementById("R").height.baseVal.value

I confess to being a bit ignorant of any reasons for preferring or not
the use of baseVal, but am considering including text such as the
following to describe the situation:

-----------------sample text---------------begin by setting
We then display the id property of that node:

which, not surprisingly, ends up being "R".

Of all the properties associated with a node, we may note that most
attributes cannot be referenced in this manner (reminiscent of HTML
DOM1). For example, the expression

is meaningless. Instead, we use

as the way to retrieve ordinary attributes associated with an SVG
object. Specifically, the command

produces, as output, the string "30".

----------now to the relevant part ----------------
An alternative approach is worth mentioning: 


As discussed at (http://www.w3.org/TR/SVG/svgdom.html ), the SVG DOM
methods allow alternative ways, beyond what is typically available in
generic XML for interrogating DOM. Given the nature of differences
between the rendered page and mark-up, in part, no doubt, due to
animation, these methods are frequently recommended. As I understand it,
baseVal represents something resembling a virtual presence of the node
in the SVG DOM, separate from its actual rendering. The topic is, at
present, a bit beyond the scope of this book (though I am hoping another
contributor might write a section about them). In the meantime, I
recommend reading about the animation sandwich model in the SMIL
animation spec
(http://www.w3.org/TR/smil-animation/#AnimationSandwichModel) that
offers an exploration of the use of base values.

------------end sample text---------

The question for you folks: given that I don't (for now)  want to create
a new section in the book, does the above text gloss over the details
adequately and (more importantly) accurately?

The book currently does not cover several topics (as I mentioned before,
I'm keeping a list in the "afterword" of sections that I'm hoping to
find authors for -- see
rword ) including shadow trees (which are somewhat similar to baseVal?).

Received on Friday, 10 April 2009 16:41:36 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:28:24 UTC