6 var camelize = function(a,b){
7 return b.toUpperCase();
12 var fillStyle = function(dom, pstyle)
14 if (!dom || dom.nodeType != 1) {
15 //console.log("SKIP: " + dom.nodeName);
18 //console.log(dom.nodeName);
20 var style = window.getComputedStyle(dom, null);
21 if (style.display == 'none' || dom.nodeName == "NOSCRIPT" || dom.nodeName == "SCRIPT" ) {
22 dom.parentElement.removeChild(dom);
27 if (dom.childNodes.length > 100) {
29 throw "too many child nodes?" + dom.childNodes.length ;
31 for (var i = 0;i < dom.childNodes.length;i++) {
32 cn.push(dom.childNodes[i]);
35 if (cn.length > 100) {
37 throw "too many child nodes? cn";
39 for (var i = 0;i < cn.length;i++) {
41 //console.log( i + ':'+ cn[i].nodeName);
42 fillStyle(cn[i], style);
47 //if (dom.nodeName != 'BODY') {
48 // pstyle = window.getComputedStyle(dom.parentElement, null);
53 //if (dom.nodeName == 'LI') { throw 'done'; }
56 for(var i=0;i<style.length;i++){
58 var camel = prop.replace(/\-([a-z])/g, camelize);
59 var val = style.getPropertyValue(prop);
60 //returns[camel] = val;
62 // idea... if the parent has the same style.. then do not apply it to the child?
63 if (pstyle && pstyle[prop] == val) {
66 //console.log(prop + '=' + val);
68 dom.style[camel] = val;
72 var es = dom.getAttribute('style');
73 //console.log(dom.nodeName + '::' + es);
74 dom.setAttribute('style', es);
82 var el = document.querySelector('body');
85 var matches = document.getElementsByTagName('style');
87 for(var i =0;i < matches.length;i++) {
91 var matches = document.getElementsByTagName('link');
92 for(var i =0;i < matches.length;i++) {
95 for(var i =0 ; i < rm.length;i++) {
96 rm[i].parentNode.removeChild(rm[i]);