Bug Tracker

Ticket #11619 (closed bug: invalid)

Opened 2 years ago

Last modified 20 months ago

I cannot get valid height on Firefox, bug?

Reported by: cyross _at_ po.twin.ne.jp Owned by: cyross _at_ po.twin.ne.jp
Priority: undecided Milestone: None
Component: unfiled Version: 1.7.2
Keywords: Cc:
Blocking: Blocked by:

Description

Hi.

I'll trying to check a value of $(window).width and $(window).height.

I succeed to get valid value on GoogleChrome(18), IE9, Android Browser(2.3.4).

But I cannot get valid height(height=8) on Firefox(11)

This problem occurred by jQuery's but? Firefox's bug?

Here is test code.

index.html
<DOCTYPE HTML>
<html>
  <head>
    <meta charset=utf-8>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>jQuery test</title>
    <link rel="stylesheet" href="gst.css" type="text/css" />
    <script type="text/javascript" src="jquery-1.7.2.js"></script>
    <script type="text/javascript" src="gst.js"></script>
  </head>
  <body>
  </body>
</html>
gst.js
(function(win){
  var size = {width: 0, height: 0};

  $(document).ready(function(){
    size.width = $(this).width();
    size.height = $(this).height();

    $("body").append("Width:"+size.width+" Height:"+size.height);
    $("body").css("overflow", "hidden");

    $div = $("<div />");
    $div.css("position", "absolute");
    $div.css("left", size.width - 1);
    $div.css("top", size.height - 1);
    $div.width(16);
    $div.height(16);
    $div.css("background-color", "red");
    $div.appendTo($("body"));
  });
})(window);

Change History

comment:1 Changed 2 years ago by cyross _at_ po.twin.ne.jp

sorry, my mistake...

gst.js
(function(win){
  var size = {width: 0, height: 0};

  $(document).ready(function(){
    size.width = $(win).width(); // here!
    size.height = $(win).height(); // here!

    $("body").append("Width:"+size.width+" Height:"+size.height);
    $("body").css("overflow", "hidden");

    $div = $("<div />");
    $div.css("position", "absolute");
    $div.css("left", size.width - 1);
    $div.css("top", size.height - 1);
    $div.width(16);
    $div.height(16);
    $div.css("background-color", "red");
    $div.appendTo($("body"));
  });
})(window);

comment:2 Changed 2 years ago by rwaldron

  • Owner set to cyross _at_ po.twin.ne.jp
  • Status changed from new to pending

Thanks for taking the time to contribute to the jQuery project! Please put your code in a test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate:  http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.

comment:3 Changed 2 years ago by trac-o-bot

  • Status changed from pending to closed
  • Resolution set to invalid

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 20 months ago by dhruvbird@…

I am seeing the same behaviour.

This is my user agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1016.0 Safari/535.19

Using jQuery 1.8.3

Note: See TracTickets for help on using tickets.