getElementProperty and getElementAttribute

162 views
Skip to first unread message

step...@yahoo.fr

unread,
Feb 21, 2008, 3:54:49 AM2/21/08
to Google Web Toolkit
Hello,

What is the difference between DOM.getElementProperty,
DOM.getElementAttribute and DOM.getStyleAttribute ?

Thanks

stuckagain

unread,
Feb 21, 2008, 10:28:55 AM2/21/08
to Google Web Toolkit
Good question,

The getElementAttribute returns an attribute used in a HTML tag.
For example <div class='myclass'></div> here class is an attribute.

The getElementProperty returns a property of a DOM node.
For example when you have a DOM node, it contains a property
clientLeft, this can be accesed with node.clientLeft

Note that many attributes are accessible as a property as well.

The getStyleAttribute is used to access styling information of a DOM
node.
so for example "background-color" is a style attribute which changes
the background color of the DOM node.
A DOM node normally has a property style that contains the different
style properties.

Hope this explains ?

David

step...@yahoo.fr

unread,
Feb 22, 2008, 1:31:07 PM2/22/08
to Google Web Toolkit
Thanks David, it's very clear !!

Franck
> > Thanks- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

step...@yahoo.fr

unread,
Mar 17, 2008, 6:15:26 AM3/17/08
to Google Web Toolkit
If I look the INNERHTML of an element i can't see some propertys
(offsetwidht, clientLeft ...), is it normal ?
Thanks

Jason Essington

unread,
Mar 17, 2008, 10:56:55 AM3/17/08
to Google-We...@googlegroups.com
Right, not all properties are necessarily translated into attributes,
and Attributes are what you see in the HTML

for the most part setProperty and setAttribute behave the same in
code, but in some situations, they do not, thus the need for both
methods.

-jason

Reply all
Reply to author
Forward
0 new messages