1

Is there a JavaScript DOM API to get the current style information (selectors and their associated CSS rules, width and height attributes, style attributes, etc.) for a node or set of nodes and save them into an XML document or similar?

I want to do automated comparison tests.

Thanks for any help.

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
moefinley
  • 1,248
  • 1
  • 13
  • 26

1 Answers1

0

Use one of the following methods:

Community
  • 1
  • 1
Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
  • I'm not sure how these help? Am I missing some XML that would give me access to all the properties I need? – moefinley Jan 15 '13 at 17:52
  • These are JavaScript functions which collect the nodes of the XML DOM and return a single string. The XPath statement `$x("//*")` can perform a similar operation from the browser console. – Paul Sweatte Jan 15 '13 at 18:15
  • Unless I'm missing something this is not what I'm after. It just returns the HTML. I want all the properties of each of the elements in the HTML/DOM. I've since found these: `getComputedStyle()` `dom.currentStyle` `dom.style` These can get me all the style information - which is what I'm interested in. – moefinley Jan 17 '13 at 18:16
  • Style and state are very different, so please rephrase your question. – Paul Sweatte Jan 17 '13 at 18:46