Update: I wrote a blog post detailing all the differences much better.
Firefox uses W3C standard Node::textContent
, but its behavior differs "slightly" from that of MSHTML's proprietary innerText
(copied by Opera as well, some time ago, among dozens of other MSHTML features).
First of all, textContent
whitespace representation is different from innerText
one. Second, and more importantly, textContent
includes all of SCRIPT tag contents, whereas innerText doesn't.
Just to make things more entertaining, Opera - besides implementing standard textContent
- decided to also add MSHTML's innerText
but changed it to act as textContent
- i.e. including SCRIPT contents (in fact, textContent
and innerText
in Opera seem to produce identical results, probably being just aliased to each other).
textContent
is part of Node
interface, whereas innerText
is part of HTMLElement
. This, for example, means that you can "retrieve" textContent
but not innerText
from text nodes:
var el = document.createElement('p');
var textNode = document.createTextNode('x');
el.textContent; // ""
el.innerText; // ""
textNode.textContent; // "x"
textNode.innerText; // undefined
Finally, Safari 2.x also has buggy innerText
implementation. In Safari, innerText
functions properly only if an element is
neither hidden (via style.display == "none"
) nor orphaned from the document. Otherwise, innerText
results in an empty string.
I was playing with textContent
abstraction (to work around these deficiencies), but it turned out to be rather complex.
You best bet is to first define your exact requirements and follow from there. It is often possible to simply strip tags off of innerHTML
of an element, rather than deal with all of the possible textContent
/innerText
deviations.
Another possibility, of course, is to walk the DOM tree and collect text nodes recursively.
Try to replace your stylesheet element with this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
You may also want to add this:
xmlns="http://www.w3.org/1999/xhtml"
Best Answer
https://bugzilla.mozilla.org/show_bug.cgi?id=98168#c99 and subsequent comments describe the current status of the bug: "disable-output-escaping" can be implemented in Firefox, but it requires a different approach when processing the stylesheet than the one used by Firefox's XSLT processor (serialize+parse instead of creating a DOM tree while processing the stylesheet). Patches are accepted, but it seems that no-one plans to spend time on fixing the issue.
Even if it's implemented, such stylesheets will require more CPU resources to be processed, and Mozilla developers say that usually there's a better solution than using d-o-e. If you want help in your specific case, you should describe it in more detail (although I probably won't be able to help).