Re: Mutation events replacement

* Dave Raggett wrote:
>Perhaps we need to distinguish auto generated attributes from those that 
>are set by markup or scripts. Could you please clarify for me the 
>difference between the html "style" attribute and the one you are 
>referring to?  My understanding is that the html style attribute is set 
>via markup or scripts and *doesn't* reflect all of the computed style 
>properties for this DOM node.

You can manipulate the style attribute using DOM Level 2 Style features
like the ElementCSSInlineStyle interface instead of setting the value
as a string as you would when using .setAttribute and similar features.

  <p>...</p>
  <script>
  onload = function() {
    var p = document.getElementsByTagName('p').item(0);
    p.style.margin = '0';
    alert(p.getAttribute('style'))
  }
  </script>

This would alert something like `margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px` or `margin: 0px;`.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Wednesday, 20 July 2011 16:42:45 UTC