KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'd like to be able to take my DOM, as is, and convert it to a string. Let's say I open up the inspector and make a change to the margin-left property of a particular element. That change should be reflected in my string. The function should properly take all the styles currently applied to an element (excluding default values) and include them in the inline style for that element. I have written a 'solution' which has proven to be inadequate. The getMatchedCSSRules function in webkit is extremely finicky, and I haven't been able to determine why it sometimes works and doesn't work other times. Therefore, I would like to avoid using this function unless it works 100% of the time. Similarly, the getComputedStyle function has problems of its own. If use the inspector to change the #footer element on this page to be 7px solid red rather than 7px solid black , the change will be reflected in when I run getComputedStyle(document.getElementById('footer')).cssText in the console, but it will also give me a host of inherited properties that were never modified by either the user using the inspector or by the stylesheets on the page. I am looking for a solution that works with webkit--cross browser compatibility is not an issue at the moment. Thank you!
Tags (comma-separated)
Save Edits
Cancel