Closed
Bug 1011330
Opened 11 years ago
Closed 10 years ago
window.matchMedia returns null in hidden iframes
Categories
(Core :: DOM: CSS Object Model, defect)
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: hello, Unassigned)
References
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release)
Build ID: 20140512231802
Steps to reproduce:
I executed window.matchMedia inside of a hidden iframe.
Actual results:
Null was returned, causing a TypeError.
Reduced test case here (open the console):
http://dev.tylerpaulson.com/tests/matchmedia/
I observed this in Firefox 30 beta and 31 aurora on OS X Mavericks.
Expected results:
A MediaQueryList object should have been returned.
Updated•11 years ago
|
Component: DOM → DOM: CSS Object Model
Comment 1•11 years ago
|
||
It's not immediately obvious to me what information it should return -- does a hidden iframe have a size, for example?
(Maybe related to bug 753777 comment 4, though (which I never filed a followup on).)
Reporter | ||
Comment 2•11 years ago
|
||
I was wondering the same thing when I filed the bug.
I'd say, no, an element hidden with display:none doesn't have a size. So any query with a media_feature of width, min-width, max-width, height, min-height, or max-height should NOT match.
One issue I can foresee is a match being false and the iframe later being first displayed into a context where it would have been true, but in the case, the 'resize' event will fire in the iframe window upon its being displayed. Developers can listen for that event and then repeat the call to matchMedia.
Comment 3•11 years ago
|
||
Or we could just treat display:none as sized 0x0...
Comment 4•10 years ago
|
||
I'm also receiving this error while trying to load content into a hidden iframe dynamically using jquery 1.9.1 and jquery mobile 1.3.2. This error does not occur on all other major browsers.
I am receiving this error too when loading a page into a hidden iframe using jQuery Mobile. This error does not occur on all other major browsers.
Comment 6•10 years ago
|
||
The patch in bug 771043 will make this return non-null, though whether you get anything useful out of the result, who knows.
Depends on: 771043
Comment 7•10 years ago
|
||
Fixed by checkin for bug 771043.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment 8•10 years ago
|
||
Has this fix made it into Firefox 35.0.1? I ran into this issue and also noticed that the testcase in comment 0 still throws this error in 35.0.1.
Comment 9•10 years ago
|
||
The target milestone for bug 771043 says "mozilla36".
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•