jQuery: The Write Less, Do More JavaScript Library

Ticket #2858 (closed enhancement: invalid)

Opened 3 months ago

Last modified 3 months ago

Redundant discriminant on window size?

Reported by: ericsk Assigned to: brandon
Type: enhancement Priority: minor
Milestone: 1.2.4 Component: dimensions
Version: 1.2.3 Keywords: window size
Cc: Needs: Review

Description

In the bottom of core.js, the following code segment is to determine which method reports the correct window size:

this[0] == window ?
      // Opera reports document.body.client[Width/Height] properly in both quirks and standards
      jQuery.browser.opera && document.body[ "client" + name ] ||
      // Safari reports inner[Width/Height] just fine (Mozilla and Opera include scroll bar widths)
      jQuery.browser.safari && window[ "inner" + name ] ||
      // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
      document.compatMode == "CSS1Compat" && document.documentElement[ "client" + name ] || document.body[ "client" + name ] :

However, I think the code

jQuery.browser.opera && document.body[ "client" + name ] ||

is redundant because this discriminant has finally tries document.body['client'+name] yet.

How do you think?

Attachments

Change History

Changed 3 months ago by flesler

  • owner set to brandon
  • component changed from core to dimensions

Changed 3 months ago by brandon

  • status changed from new to closed
  • resolution set to invalid

The comment above the line in question states that opera needs to use document.body for both standards and quirks modes.

Note: See TracTickets for help on using tickets.