JavaScript: Reading/Writing to TextArea with "innerText"
Maksim Orlovich
mo85 at cornell.edu
Wed Jun 6 14:22:43 BST 2007
> Hi!
>
> At the moment I have some fun with extending konqueror to support a
> special web service. Among other problems which still needs to be
> fixed (like a proper support of iFrames), I had to add a feature
> which seems to be supported by IE (see example "eingabefeld.html"
> below). The example changes the attribute "innerText" within a
> textarea. This patch adds reading and writing to a textarea which was
> not available in the implementation in KDELibs 3.5.x. The
> modification is quite simple, therefore I would like to ask whether
> this modification is ok or not. In the latter case: It would be nice
> to know what needs to be added to implement it the right way.
Good catch, but I am afraid this isn't neccesserilly so simple. The reason
it "doesn't work" is that the value of a text area isn't the same as the
value of its text children, which is what the normal innerText changes.
So there are a couple of questions that need to be answered first:
a) Does changing the child text nodes reset the value? If so, innerText
should not be changed, but HTMLFormElementImpl needs to work for child
changes, which would be rather tricky.
b) Does setting innerText change the DOM children? If so, your patch
should probably be using setDefaultValue, not setValue.
c) If value isn't the same as defaultValue, which one does innerText return?
Also, it'd probably be better to implement this in html/ and not ecma/ ---
by making setInnerText/innerText virtual and overriding in
HTMLTextAreaImpl
Do you have any real testcases, and not just an example?
Thanks,
Maks
More information about the kfm-devel
mailing list