Sunday, April 24, 2011

Non-breaking space &othrs in Firefox

There are times where Internet Explorer surprises me. I've encountered numerous instances where css/javascript works perfectly fine in Firefox but screws up badly in IE 7 or IE 6. But the real surprise comes when things work in IE but fail in Firefox..

For example, HTML entities used by names, if not suffixed by a semicolon, and not separated by a space with the following word, fail to render in Firefox 3. It works fine in Internet Explorer 6, 7, 8, 9 and all versions of Chrome.

The following html code would appear differently in Firefox than other browsers:
There is a space between the two spaces: space&nbspspace
The following rendered html would retain the HTML entity nbsp in Firefox, would work fine in other browsers (You will have to visit this blog page in both a Firefox and a non-Firefox browser to know the difference):
There is a space between the two spaces: space space 
Using either " space" or "&nbsp space" does the trick in Firefox 3 as well. This is true not only for non-breaking space but for all HTML entities.

Firefox 4 seems to have fixed this problem. Well, yeah, I agree, it is not a problem, only rigid syntax. If you miss a semi-colon at the end of an HTML entity you used by name, and you are tight-bound for whitespace, you are in for a surprise if you are using a Firefox version<4.

But I wonder what took the guys at Mozilla six-and-a-half years to accommodate this developer-friendly convenient feature.

No comments:

Post a Comment