X
點擊此處開啟此網站的行動版。

技術支援討論區

An error in Firefox code

已張貼

I am a web developer, and i am using Iceweasel 31.7.0 (which is based of Firefox) under Linux Debian wheezy.

A problem appears when i am writing a javascript code. My goal is to determine a size of screen (i am using typical pc, not any mobile device). So i am writing:

var body = window.document.body.style

// block to determine width body.height = '1px' for ( var i = 0; ; i++ ) {

  body.width = i + 'px'

window.document.documentElement.scrollLeft = 1

  if ( window.document.documentElement.scrollLeft != 0 )

break } i--

// block to determine height body.width = '1px' for ( var k = 0; ; k++ ) {

  body.height = k + 'px'

window.document.documentElement.scrollTop = 1

  if ( window.document.documentElement.scrollTop != 0 )

break } k--

body.width = ( i ) + 'px' body.height = ( k ) + 'px'


So after this code both scroll line appears! When it should not be because i an k variables are choosen maximum without scroll. And, moreover, an error disappears (both scroll lines disappears) when two blocks switched by place each other (first determine height, then width).

I'll appreciate at least confirmation that it is an error, even if you cannot provide a patch for Iceweasel. Thank you.

I am a web developer, and i am using Iceweasel 31.7.0 (which is based of Firefox) under Linux Debian wheezy. A problem appears when i am writing a javascript code. My goal is to determine a size of screen (i am using typical pc, not any mobile device). So i am writing: var body = window.document.body.style // block to determine width body.height = '1px' for ( var i = 0; ; i++ ) { body.width = i + 'px' window.document.documentElement.scrollLeft = 1 if ( window.document.documentElement.scrollLeft != 0 ) break } i-- // block to determine height body.width = '1px' for ( var k = 0; ; k++ ) { body.height = k + 'px' window.document.documentElement.scrollTop = 1 if ( window.document.documentElement.scrollTop != 0 ) break } k-- body.width = ( i ) + 'px' body.height = ( k ) + 'px' -------------------------------------------------------------------------------------------- So after this code both scroll line appears! When it should not be because i an k variables are choosen maximum without scroll. And, moreover, an error disappears (both scroll lines disappears) when two blocks switched by place each other (first determine height, then width). I'll appreciate at least confirmation that it is an error, even if you cannot provide a patch for Iceweasel. Thank you.

額外的系統細節

已安裝的外掛程式

  • Shockwave Flash 10.1 r999.Gnash 0.8.11dev, the GNU SWF Player. Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Gnash comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of Gnash under the terms of the GNU General Public License. For more information about Gnash, see http://www.gnu.org/software/gnash. Compatible Shockwave Flash 10.1 r999.
  • This plugin provides integration with Gnome Shell for live extension enabling and disabling. It can be used only by extensions.gnome.org
  • This plug-in detects the presence of iTunes when opening iTunes Store URLs in a web page with Firefox.

應用程式

  • User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.7.0

更多資訊

FredMcD
  • Top 10 Contributor
4245 個解決方法 59390 個答案

I've called the big guys to help you. Good luck.

I've called the big guys to help you. Good luck.
guigs 1072 個解決方法 11697 個答案

Iceweasel is a rebranded version of Firefox and is maintained by the Debian community afaik. However I did take a look at the script and played a bit in jsfiddle. It looks like the scrollbars will appear anyway .

You might be able to get some better feedback in the stackoverflow.com forums as well:

Iceweasel is a rebranded version of Firefox and is maintained by the Debian community afaik. However I did take a look at the script and played a bit in jsfiddle. It looks like the scrollbars will appear anyway . *[http://jsfiddle.net/xn8tg8dn/] You might be able to get some better feedback in the stackoverflow.com forums as well: *[https://support.mozilla.org/en-US/kb/where-go-developer-support Where to go for developer support]