[whatwg] [html5] window.print() undefined

Matthew Raymond mattraymond at earthlink.net
Tue Jul 19 03:06:58 PDT 2005

Dean Edwards wrote:
> OK, we don't switch media. But when I press "print" or invoke the print 
> method, a copy of the DOM is sent to the printer. If I have altered the 
> DOM by adding elements or by changing the style property then I would 
> like to be able to undo those changes before my DOM goes to the printer. 
> It is not good enough to say that I should start messing about with 
> classes and so forth or that it is bad practice to amend the style 
> property directly. So long as I can do these things I want a way to undo 
> them before my DOM is sent to a print device.

   I know this isn't how you meant it, but this all seems a bit user
hostile. The user sees something on the screen he/she wants to print,
but an event is called at the last minute that changes the content to
something else before the user can print. So if I select the part of the
page you want to "undo" and tried to print the selection, I'd get a
blank page? And in theory, the entire page could be hidden. Sounds like
print-specific DRM to me.

   Perhaps what you really want is a media-specific way of setting
styling properties:

| element.style.media("print").display = "block";

More information about the whatwg mailing list