W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2005

[whatwg] [html5] onbeforeprint/onafterprint (was window.print() undefined)

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Wed, 20 Jul 2005 13:12:03 -0400
Message-ID: <42DE85E3.2000401@earthlink.net>
Dean Edwards wrote:
> Matthew Raymond wrote:
>>| if (documentchanged) {
>>|   printClone = document.clone();
>>|   prepareForPrinting(printClone);
>>| }
>>|
>>| printClone.print();
> 
> This seems less practical than print events.

   I don't see how:

| OnBeforePrintEventFunction() {
|   prepareForPrinting(document);
| }
|
| OnAfterPrintEventFunction() {
|   restoreForScreen(document);
| }

   With my method, you don't have to worry about restoring anything,
because you can just get rid of the clone once you're done printing.

> It is also very difficult to detect changes to the document.

   Perhaps. Depends on the application.

> What do you mean by changes? Style
> changes? New/removed content?
> 
> I quite like the idea of a DOMModified event. Does this exist? Can we 
> have it please?

   I think the DOM spec already has events that fire when you alter the
DOM. Here's some DOM notes I took regarding unimplemented DOM stuff in
Mozilla...

| DOM2
| - Events for interface MutationEvent
| -- DOMSubtreeModified
| -- DOMNodeRemovedFromDocument
| -- DOMNodeInsertedIntoDocument

   I don't think IE supports that either, or Opera for that matter.
Received on Wednesday, 20 July 2005 10:12:03 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:42 UTC