From: <no...@us...> - 2003-06-23 14:27:37
|
Log Message: ----------- Fix for bug 759217:HtmlTextArea use HtmlNode for setText Patch submitted by Barnaby Court Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml todo.xml /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html: HtmlTextArea.java Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.109 retrieving revision 1.110 diff -u -d -r1.109 -r1.110 --- changes.xml 20 Jun 2003 17:38:37 -0000 1.109 +++ changes.xml 23 Jun 2003 14:27:33 -0000 1.110 @@ -115,8 +115,12 @@ Added instructions for the "how to compile from cvs" document. Patch provided by Barnaby Court. </action> + <action type="update" dev="mbowler" due-to="Barnaby Court" id="759217"> + Changed HtmlTextArea.setText() to actually modify the DOM + Patch provided by Barnaby Court. + </action> </release> - </body> + </body> <body> Index: todo.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/todo.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- todo.xml 11 Apr 2003 19:29:18 -0000 1.7 +++ todo.xml 23 Jun 2003 14:27:34 -0000 1.8 @@ -4,6 +4,7 @@ <properties> <title>TODO list</title> <author email="mb...@Ga...">Mike Bowler</author> + <author email="Bar...@us...">BarnabyCourt</author> <revision>$Revision$</revision> </properties> @@ -21,7 +22,6 @@ <ol> <li>implement Document.write()</li> <li>Have TopLevelWindow's deregister themselves with WebClient when they are closed</li> - <li>HtmlTextArea.getText() and setText() currently don't modify the dom. This should be fixed</li> <li>Support for file urls</li> <li>Use HtmlUnit to verify all links in generated documentation</li> </ol> Index: HtmlTextArea.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlTextArea.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- HtmlTextArea.java 10 Jun 2003 11:56:58 -0000 1.10 +++ HtmlTextArea.java 23 Jun 2003 14:27:34 -0000 1.11 @@ -37,16 +37,19 @@ */ package com.gargoylesoftware.htmlunit.html; +import org.apache.html.dom.HTMLTextAreaElementImpl; +import org.w3c.dom.Element; + import com.gargoylesoftware.htmlunit.Assert; import com.gargoylesoftware.htmlunit.KeyValuePair; -import org.w3c.dom.Element; /** * Wrapper for the html element "textarea" * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> - */ + * @author <a href="mailto:Bar...@us...">Barnaby Court</a> + */ public class HtmlTextArea extends HtmlElement implements SubmittableElement { @@ -61,6 +64,7 @@ */ HtmlTextArea( final HtmlPage page, final Element element ) { super( page, element ); + value_ = getText(); } @@ -81,12 +85,8 @@ * @return The text */ public final String getText() { - if( value_ == null ) { - return asText(); - } - else { - return value_; - } + HTMLTextAreaElementImpl textElement = (HTMLTextAreaElementImpl) getElement(); + return textElement.getTextContent(); } @@ -114,7 +114,9 @@ */ public final void setText( final String newValue ) { Assert.notNull("newValue", newValue); - value_ = newValue; + + HTMLTextAreaElementImpl textElement = (HTMLTextAreaElementImpl) getElement(); + textElement.setTextContent(newValue); } @@ -136,7 +138,7 @@ * Return the value of this element to what it was at the time the page was loaded. */ public void reset() { - value_ = null; + setText(value_); } |