Closed Bug 1304678 Opened 9 years ago Closed 8 years ago

getComputedStyle return wrong style in print mode

Categories

(Core :: CSS Parsing and Computation, defect)

52 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: guillaume.baty, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20160921030221 Steps to reproduce: Create a basic html page with 2 styles: - one for @media screen - one for @media print Watch events - window.onbeforeprint - window.onafterprint Get computed style each time these events are triggered (by using "print" or "print preview". Note: emulate media print do not trigger these events) See attached example Actual results: getComputedStyle always return "@media screen" style Expected results: style returned by getComputedStyle should correspond to "@media print" style at least in one of the two events: onbeforeprint, onafterprint. Maybe I am wrong for when print style should be applied or how to manage this case (get "@media print" computed style) ... Thank you for you answer
Component: Untriaged → JavaScript Engine
I don't see anything related to JS engine in this bug. anyway, those events are not related to actual printing, but they're called before and after. returning "@media screen" style should be correct.
Component: JavaScript Engine → CSS Parsing and Computation
Flags: needinfo?(aschen)
I agree with :arai that this seems to be the expected behavior. Those events are triggered before and after the printing, and the "@media print" should only be effective between them, so none of them should have computed value from "@media print". I'm going to close this bug as INVALID. However I can understand that people may want to run script based on the new style for printing. That is probably something the spec should add. But given the current spec, I believe Firefox's behavior is correct. You may want to raise an issue to the HTML spec here: https://github.com/whatwg/html/issues
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Flags: needinfo?(aschen)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: