C
Csaba Gabor
In my Firefox 1.5 (on Win XP Pro) a <BR>
element's .textContent returns the empty string.
I have no idea why they (W3C) construed this to
be reasonable, but it was contested, and denied
here:
https://bugzilla.mozilla.org/show_bug.cgi?id=316063
Boris suggests doing something else to get what
I believe most users are really after, but doesn't
say what. Here's a possible approach, with initial
tests working in my FF1.5:
HTMLBRElement.prototype.__defineGetter__("innerText",
function() {return "\n";});
Node.prototype.__defineGetter__("innerText",
function() {
if (!this.firstChild) return this.textContent;
s=this.firstChild;
var res=s.innerText;
while (s=s.nextSibling) res+=s.innerText;
return res; });
However, it would be FFFFAAAAAAARRRR nicer
to simply redefine .textContent on the
HTMLBRElement.prototype and not muck about
with innerText, all on account of the <BR> element
adhering to a standard (whose reasonableness
on this point escapes me). However, the following
line is ignored as far as I can tell - any ideas?:
HTMLBRElement.prototype.__defineGetter__("textContent",
function() {return "\n";});
Thanks,
Csaba Gabor from Vienna
element's .textContent returns the empty string.
I have no idea why they (W3C) construed this to
be reasonable, but it was contested, and denied
here:
https://bugzilla.mozilla.org/show_bug.cgi?id=316063
Boris suggests doing something else to get what
I believe most users are really after, but doesn't
say what. Here's a possible approach, with initial
tests working in my FF1.5:
HTMLBRElement.prototype.__defineGetter__("innerText",
function() {return "\n";});
Node.prototype.__defineGetter__("innerText",
function() {
if (!this.firstChild) return this.textContent;
s=this.firstChild;
var res=s.innerText;
while (s=s.nextSibling) res+=s.innerText;
return res; });
However, it would be FFFFAAAAAAARRRR nicer
to simply redefine .textContent on the
HTMLBRElement.prototype and not muck about
with innerText, all on account of the <BR> element
adhering to a standard (whose reasonableness
on this point escapes me). However, the following
line is ignored as far as I can tell - any ideas?:
HTMLBRElement.prototype.__defineGetter__("textContent",
function() {return "\n";});
Thanks,
Csaba Gabor from Vienna