This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24160 - Should innerWidth/Height and company really be readonly?
Summary: Should innerWidth/Height and company really be readonly?
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: CSSOM View (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Simon Pieters
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-23 05:22 UTC by Boris Zbarsky
Modified: 2015-04-07 07:36 UTC (History)
1 user (show)

See Also:


Attachments

Description Boris Zbarsky 2013-12-23 05:22:53 UTC
Or should they have a no-op setter?  The difference is that readonly throws an exception on set in strict mode.

This testcase:

  <script>
  "use strict";
  try {
    window.innerWidth = 0;
    alert("REACHED");
  } catch (e) { alert(e); }
  </script>

alerts "REACHED" for me in IE9, Gecko, Presto, Blink, and WebKit, so it seems a bit worrisome to suddenly make this case throw... esp in quirks mode.
Comment 1 Simon Pieters 2015-04-02 14:28:28 UTC
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3483

Gecko has a no-op setter
WebKit/Blink/Presto have [Replaceable]
IE11 throws.

Rossen, have you found Web compat problems for throwing here?

Test for all attributes on Window in CSSOM View:

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3484
Comment 2 Simon Pieters 2015-04-02 14:51:34 UTC
Hmm, now I get no-op setter for everything in IE11 (except scrollX/scrollY which are not supported.)

http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3486

   Feature      Gecko    Blink    WebKit   IE11     Presto
screen            T        N        R        N        R
innerWidth        N        R        R        N        R
innerHeight       N        R        R        N        R
scrollX           R        R        R        S        R
pageXOffset       T        N        T        N        R
scrollY           R        R        R        S        R
pageYOffset       T        N        T        N        R
screenX           N        R        R        N        N
screenY           N        R        R        N        N
outerWidth        N        R        R        N        N
outerHeight       N        R        R        N        N
devicePixelRatio  T        R        R        N        N

T = TypeError
N = no-op setter
R = [Replaceable]
S = not supported
Comment 3 Simon Pieters 2015-04-02 14:59:09 UTC
Does it seem OK to make all of these [Replaceable] ? That's closest to WebKit and seems like it has the least potential of breaking scripts that set these to something and then expect to get the value they set it to.
Comment 4 Boris Zbarsky 2015-04-02 16:23:17 UTC
I could probably live with that.