6 //var camelize = function(a,b){
7 // return b.toUpperCase();
10 var keys = ['fontFamily','fontSize','fontWeight','fontStyle','color',
11 'textTransform','textDecoration','letterSpacing','wordSpacing',
12 'lineHeight','textAlign','verticalAlign','direction','backgroundColor',
13 'backgroundImage','backgroundRepeat','backgroundposition',
14 'backgroundAttachment','opacity','width','height','top','right','bottom',
15 'left','marginTop','marginRight','marginBottom','marginLeft',
16 'paddingTop','paddingRight','paddingBottom','paddingLeft',
17 'borderTopWidth','borderRightWidth','borderBottomWidth',
18 'borderLeftWidth','borderTopColor','borderRightColor',
19 'borderBottomColor','borderLeftColor','borderTopStyle',
20 'borderRightStyle','borderBottomStyle','borderLeftStyle','position',
21 'display','visibility','zIndex','overflowX','overflowY','whiteSpace',
22 'clip','float','clear','cursor','listStyleImage','listStylePosition',
23 'listStyleType','markerOffset'
26 var fillStyle = function(dom)
28 if (!dom || dom.nodeType != 1) {
31 console.log(dom.nodeName);
33 var style = window.getComputedStyle(dom, null);
34 if (style.display == 'none') {
35 dom.parentElement.removeChild(dom);
39 if (dom.nodeName != 'BODY') {
40 pstyle = window.getComputedStyle(dom.parentElement, null);
45 for(var i=0;i<style.length;i++){
47 //var camel = prop.replace(/\-([a-z])/g, camelize);
48 var val = style.getPropertyValue(prop);
49 //returns[camel] = val;
51 // idea... if the parent has the same style.. then do not apply it to the child?
52 if (pstyle && pstyle[prop] == val) {
55 console.log(prop + '=' + val);
56 dom.style[prop] = val;
58 for (var i = dom.childNodes.length -1; i--; i> -1) {
59 fillStyle(dom.childNodes[i]);
65 var el = document.querySelector('body');
68 var matches = document.getElementsByTagName('style');
69 for(var i =0;i < matches.length;i++) {
70 matches[i].parentElement.removeChild(matches[i]);
72 var matches = document.getElementsByTagName('link');
73 for(var i =0;i < matches.length;i++) {
74 matches[i].parentElement.removeChild(matches[i]);