Re: Removal of empty div/spans in Firefox (re: ISSUE-67 was: Re: Golly gosh!)

On Feb 2, 2011, at 16:38, Manu Sporny wrote:

> For those of you that missed the call yesterday and haven't had a chance
> to read the minutes yet, I mentioned that Firefox removes div/span
> elements that don't have any content... stuff like this:
> 
> <div about="#foo"><span property="bar" content="baz"></span></div>

No, they aren't removed:
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/820

> I was suggesting that the browser may see this as "whitespace" and thus
> it removes what it deems to be superfluous whitespace. This had to do
> with feedback from Henri Sivonen on RDFa Core that we were reviewing
> yesterday, specifically:
> 
> """
> Henri Sivonen: Under 4.1 the statement about whitespace seems to say
> that authors should assume non-conforming processors.
> 
> Toby Inkster: Would anyone object to removing the second and third
> sentances from the last paragraph of section 4.1? [EDIT]
> """

This is unrelated.

>> http://buzzword.org.uk/2011/test-empty-span.html
>> 
>> Try in Firefox versus Opera. (I tested 3.6.2 and 11.0 respectively.)
> 
> Just tested this in Firefox 4.0 Beta 10 - that browser removes "empty"
> div/spans as well, so it looks like Mozilla may not fix this bug (if
> they even view it as a bug). Henri, is this being tracked as a bug in
> Firefox? Is it not a bug?

The test isn't testing what you are trying to test. The test sets innerText. Firefox doesn't support innerText, so the test ends up setting a custom property on the node instead of assigning to the IE-ism. The property you are looking for is textContent.

Whether the non-support of innerText is a bug depends on whether one considers innerText to have become part of the platform. innerText is pretty weird in the sense that the computed style affects how a property on the content tree behaves. innerText hasn't been reverse engineered and specced properly, yet, so one might argue that it's not bug at least as long as there isn't a proper spec for innerText. 

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Thursday, 3 February 2011 08:27:23 UTC