Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts

    DOM Styles FF Cache Problem.

    Hi,
    here is an example of what is happening with fire fox and what process I am trying to accomplish.

    EXAMPLE

    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.
    Last edited by ubh; 09-26-2008 at 06:05 PM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Code:
    var makeCssTextNode = document.createTextNode("#" + elementIds + "{" +  "\n" + " " + elementStyles + "\n" + "}" + "\n\n");	
    				var getCssBox = document.getElementById("mainCSSBox");
    				getCssBox.appendChild(makeCssTextNode);
    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.
    Code:
    var makeCssText = "#" + elementIds + "{" +  "\n" + " " + elementStyles + "\n" + "}" + "\n\n";	
    				var getCssBox = document.getElementById("mainCSSBox");
    				getCssBox.value=makeCssText;
    Last edited by Kor; 09-26-2008 at 04:59 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • Users who have thanked Kor for this post:

    ubh (09-26-2008)

  • #3
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    wow very interesting.
    thanks again kor, learning new things each day!

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    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.:

    http://www.w3.org/TR/DOM-Level-3-Cor...e3-textContent
    http://www.w3.org/TR/DOM-Level-2-HTM...ml#ID-24874179

    That means FF is right and IE is wrong, as far as I can see
    Last edited by Kor; 09-26-2008 at 05:13 PM.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    no surprise that its leaning on IE again

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

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

    EXAMPLE

    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.

  • #6
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts
    Ha see I am learning lol this was a simple fix.

    Code:
    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.

    AWESOME!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •