View Full Version : Resolved DOM Styles FF Cache Problem.

09-26-2008, 04:29 PM
here is an example of what is happening with fire fox and what process I am trying to accomplish.

EXAMPLE (http://www.geocities.com/ubhiceist/index3.html)

Notice that in IE after creating a box and changing its color the CSS source box below reflects the changes correctly vs FF whos changes are not caught and seem to be cached.

09-26-2008, 04:56 PM
var makeCssTextNode = document.createTextNode("#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n");
var getCssBox = document.getElementById("mainCSSBox");

Contrary to the HTML appearance, a textarea element has no childNodes, thus you can not append a textNode. A textarea has a value attribute which controls its text, same as a textbox.

var makeCssText = "#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n";
var getCssBox = document.getElementById("mainCSSBox");

09-26-2008, 05:02 PM
wow very interesting.
thanks again kor, learning new things each day!

09-26-2008, 05:10 PM
In fact, well, stricto sensum, textarea has a textNode, but, excepting the case when it is initially and physically HTML written as a textNode, textarea supposes to show its value. The value attribute is the only one which matters for a form's control.:


That means FF is right and IE is wrong, as far as I can see :)

09-26-2008, 05:22 PM
no surprise that its leaning on IE again :)

One more question kor and I swear I will leave ya alone :D

after cutting out the textNode I have a slight problem..
see example again:


If I now have more than one element into the mix the script fails to display all elements styles in the css box. It only locates the last node. these corners I keep painting my self into are very frustrating.

09-26-2008, 05:50 PM
Ha see I am learning lol this was a simple fix.

var makeCssText = "#" + elementIds + "{" + "\n" + " " + elementStyles + "\n" + "}" + "\n\n";
var getCssBox = document.getElementById("mainCSSBox");
getCssBox.value= getCssBox.value+makeCssText;

each time it loops for a new element, it re-assigns the former value of the textarea to the current value of the text area until the over all string is complete.