Open
Bug 1174844
Opened 9 years ago
Updated 2 years ago
Window match media fail when Iframe is hidden
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
UNCONFIRMED
People
(Reporter: nbhatti, Unassigned)
Details
Attachments
(1 file)
1.29 KB,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150525141253
Steps to reproduce:
Window match media code fails when Iframe is hidden. If we run following code in hidden Iframe, it fails
function d() {
var w = window, qo = "(max-device-width : 767px)";
var q = "(device-width : 960px) and (orientation: landscape)";
var format = "big", uformat = "unknown", mformat = "small";
var mobile=false, phablet=false;
if (w.matchMedia == null ){
format = uformat;
} else if(w.matchMedia(qo) != null) {
if (w.matchMedia(qo).matches || w.matchMedia(q).matches ) {
format = mformat;
}
} else {
format = uformat;
}
var deviceLayout = "Device layout is=" + format;
console.log(deviceLayout);
deviceLayout="";
}
Actual results:
window.matchMedia("max-device-width : 767px").matches returns true, even screen size is bigger than 767px (or any size).
Expected results:
window.matchMedia("max-device-width : 767px").matches, should have returned false, if size is bigger than 767px.
Attachments:
I have two attached files. But there is no way for me to attach second one. I have attached the first file. Please run following code by creating second file.
<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, height=device-height, user-scalable=no, initial-scale=1, minimum-scale=1, maximum-scale=1"><script>
function d() {
var w = window, qo = "(max-device-width : 767px)"; var q = "(device-width : 960px) and (orientation: landscape)";
var format = "big", uformat = "unknown", mformat = "small";
var mobile=false, phablet=false;
if (w.matchMedia == null ){
format = uformat;
} else if(w.matchMedia(qo) != null) {
if (w.matchMedia(qo).matches || w.matchMedia(q).matches ) {
format = mformat;
}
} else {
format = uformat;
}
var deviceLayout = "Device layout is=" + format;
console.log(deviceLayout);
deviceLayout="";
}</script></head><body onload="d()">
</body></html>
Hello nbhatti,
Can you try to update to Firefox version 42 and see if this issue still exists? Thanks.
Flags: needinfo?(nbhatti)
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Hello Grover,
I tried again today. I am afraid it is not fixed. I am still seeing the issue. When IFrame is hidden, windows match media fails.
Flags: needinfo?(nbhatti)
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•