Whitespace in Firefox

I have been busy doing stuff with the DOM at work. One thing that continually bugs me is that Firefox seems to find a lot of whitespace and called them textnodes. Obviously when you use firstChild, lastChild, nextSibling or previousSibling and you think that what you are getting from your script should be a div or something other than a textnode this can cause some problems.

Internet Explorer seems to have no problem negotiating the whitespace which annoys me as I really like using Firefox and this is one of the few bad things I have come across concerning this browser.

Whitespace in the DOM explains why this happens and provides a handy little script that helps overcome the problem. It probably explains the problem better than I have as well!

Comments

2 Responses to “Whitespace in Firefox”

  1. nuthell

    great.today,when i was coding with firefox,i met the problem.the code is here.
    /*—————–*/
    function mycall(element){
    element=$(element);
    alert(element.className);
    element.nextSibling.style.display=”none”;
    }
    /*———–*/
    the key word-”nextSibling” works well with IE,but died with Firefox.

  2. matthew

    Yep - that looks like the problem - sometimes you can go into the html and remove the spaces and that sorts it but I think the script I mention above takes out the guess work.

Leave a Reply

Stuff I Dugg

  • Drivable Star Wars Landspeeder Kicks Ass

  • One Less Windows User

    After nearly five years, I needed to update my personal computer. My old Dell Inspiron has long since been rendered quaint by advances in processor speed and hard drive capacity. Rather than buy a new machine running Windows Vista or take the Mac plunge, I decided to walk the open source walk.

  • 20 Tech Habits to Improve Your Life

    A few new habits can make the difference between staying on task, finding what you need, and getting things done--or having a tech meltdown.

  • Space Cube - The World's Smallest Linux PC

    Meet the Space Cube — the world's smallest fully functional PC. Primarily designed for use in space, it somehow manages to cram a working PC with USB ports, card readers, audio outputs and proprietary interfaces into a tiny cube chassis measuring just two inches square. It runs a basic Linux front-end.

  • How Simple Web Design Helps Your Business

    It’s crucial to have simple web designs to allow the user to quickly find the information they need, especially if you are selling a product. If the page is cluttered with useless text, widgets or unrelated products, the site becomes meaningless.

  • 24 Core, 48GB Linux Render Cluster built inside IKEA Cabinet

    This amazing Linux Cluster consists of 6 Intel Core 2 Quad(2.4GHZ) Processors, 48GB of RAM spread across 6 GIGABYTE GA-G33M-DS2R Micro ATX motherboards and put inside an IKEA Helmer cabinet, WHY YOU ASK? 3D computer rendering is very CPU intensive and the best way so speed up slow render problems, are usually to distribute them on to more computers

  • 25 killer Linux apps

    The very best software for your Linux machine.

  • Lego Star Wars Olympics 2008 [Flickr Photo Set]

    Beijing 2008 Olympic Games

  • Leaked Document Shows Verizon's Anti-iPhone Propaganda

    Verizon's tactics to combat the Jesusphone 3G now include briefing its employees about the iPhone's failings, so they can answer customer questions about why it doesn't carry the device.

  • 10 Good UNIX Usage Habits

    Adopt 10 good habits that improve your UNIX® command line efficiency -- and break away from bad usage patterns in the process. This article takes you step-by-step through several good, but too often neglected, techniques for command-line operations.

Subscribe

Who Am I?

No Sweat Apparel.com