A method for editing a document, the document comprising elements in a markup language rendered by a web browser in a window, the method comprising: presenting the document in the window; receiving a request to edit a portion (202, 204) of the document; in response to the request, creating an editing surface in the window, the created editing surface overlaying the portion (202, 204) of the document as displayed in the window and copying the portion (202, 204) of the document to the editing surface, wherein creating the editing surface overlaying the portion of the document as displayed in the window further comprises: determining a position and a size of the portion of the document as displayed in the window; making the portion of the document as displayed in the window invisible; and adding markup to the document to create an editing surface element in the document, which, when rendered by the web browser, causes the editing surface to be displayed in the window at the position and of the size of the portion of the document; receiving one or more changes to the portion (202, 204) of the document within the editing surface; receiving a request to stop editing the portion (202, 204) of the document; and in response to receiving the request, applying the one or more changes to the document and destroying the editing surface, wherein receiving one or more changes to the portion of the document within the editing surface comprises: receiving input within the window; upon receiving the input, determining whether the editing surface element will process the input; upon determining that the editing surface element will process the input, passing the input to the editing surface element for processing, and performing a reflow operation on the editing surface element comprising dynamically maintaining the size and position of the editing surface; and upon determining that editing surface element will not process the input, applying the one or more changes to the document, removing the editing surface element from the document, and making the portion of the document as displayed in the window visible. presenting the document in the window; receiving a request to edit a portion (202, 204) of the document; in response to the request, creating an editing surface in the window, the created editing surface overlaying the portion (202, 204) of the document as displayed in the window and copying the portion (202, 204) of the document to the editing surface, wherein creating the editing surface overlaying the portion of the document as displayed in the window further comprises: determining a position and a size of the portion of the document as displayed in the window; making the portion of the document as displayed in the window invisible; and adding markup to the document to create an editing surface element in the document, which, when rendered by the web browser, causes the editing surface to be displayed in the window at the position and of the size of the portion of the document; determining a position and a size of the portion of the document as displayed in the window; making the portion of the document as displayed in the window invisible; and adding markup to the document to create an editing surface element in the document, which, when rendered by the web browser, causes the editing surface to be displayed in the window at the position and of the size of the portion of the document; receiving one or more changes to the portion (202, 204) of the document within the editing surface; receiving a request to stop editing the portion (202, 204) of the document; and in response to receiving the request, applying the one or more changes to the document and destroying the editing surface, wherein receiving one or more changes to the portion of the document within the editing surface comprises: receiving input within the window; upon receiving the input, determining whether the editing surface element will process the input; upon determining that the editing surface element will process the input, passing the input to the editing surface element for processing, and performing a reflow operation on the editing surface element comprising dynamically maintaining the size and position of the editing surface; and upon determining that editing surface element will not process the input, applying the one or more changes to the document, removing the editing surface element from the document, and making the portion of the document as displayed in the window visible. receiving input within the window; upon receiving the input, determining whether the editing surface element will process the input; upon determining that the editing surface element will process the input, passing the input to the editing surface element for processing, and performing a reflow operation on the editing surface element comprising dynamically maintaining the size and position of the editing surface; and passing the input to the editing surface element for processing, and performing a reflow operation on the editing surface element comprising dynamically maintaining the size and position of the editing surface; and upon determining that editing surface element will not process the input, applying the one or more changes to the document, removing the editing surface element from the document, and making the portion of the document as displayed in the window visible. applying the one or more changes to the document, removing the editing surface element from the document, and making the portion of the document as displayed in the window visible.