Closed
Bug 110397
Opened 23 years ago
Closed 23 years ago
innerHeight and innerWidth pollute the window scope
Categories
(SeaMonkey :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla0.9.7
People
(Reporter: jud, Assigned: jst)
Details
(Whiteboard: [HAVE FIX])
Attachments
(1 file)
6.57 KB,
patch
|
peterv
:
review+
brendan
:
superreview+
|
Details | Diff | Splinter Review |
This is causing problems w/ http://www.intelihealth.com.
Assignee | ||
Comment 2•23 years ago
|
||
Assignee | ||
Comment 3•23 years ago
|
||
The attached patch makes innerHeight, innerWidth, outerWidth, outerWidth, screenX, screenY, status, and name "replaceable" if assigned to w/o fully qualifying the name (i.e. |window.name = "foo";| will set the window name, |var name = "foo"| (with or w/o the |var|) will not set the window name).
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: --- → mozilla0.9.7
Comment 4•23 years ago
|
||
Comment on attachment 58095 [details] [diff] [review] Make a bunch of writable properties replaceable. r=peterv.
Attachment #58095 -
Flags: review+
Comment 5•23 years ago
|
||
Is it possible to do this for location as well? or is it harder because it is already coded in DOMClassInfo? we have a couple of bugs about var location not shadowing window.location.
Won't this cause backward compatibility problems? Since to window. or not to window. has historically been equivalent, websites have been uncareful about which they used. This patch draws a distinction; it makes them no longer equivalent. Now "window.innerHeight=200" will change the window's size, but "innerHeight=200" won't. This will happen to prevent intellihealth's JS from tripping over Mozilla but I'm betting it will surprise other sites. With the distinction having historically been unimportant, the web is full of examples of all possible styles of usage. I imagine. I agree that the new distinction is logical. And it probably won't cause very many problems because most websites wouldn't use innerHeight to size their windows, since it wouldn't work on IE. Hmm. I guess I like the patch because I think it'll do more good than harm. But I am concerned what it means to begin drawing a distinction between using the window. qualifier or not. From David Flanagan's JavaScript book: "In some cases, it is useful to use [window. or self.] to make your code clearer or to disambiguate it. Using these properties is largely a stylistic matter, however."
Assignee | ||
Comment 7•23 years ago
|
||
Yup, the big question here is "What's worse, what we have or what we'll get?". I don't know the answer, but I suspect that this patch would fix more sites that it would break. The only possible way to find out, IMO, is to check it in and see how it goes (i.e. leave it in for a milestone or so). Fabian, I don't want to do this for location since I know I've seen people do: location = "http://..."; and that does work in IE and NS4x and Mozilla, if we'd make this change for location as well the above wouldn't work in mozilla any more and location is kinda frequently used so I say no :-)
Assignee | ||
Comment 8•23 years ago
|
||
I talked to Vidur about this and his thought's about this are the same as mine, it's probably ok to do this for the properties mentioned above, but we'd better leave location alone. Brendan, Jband, whaddaya think?
Comment 9•23 years ago
|
||
The location botches must be because the 4.x or earlier JS engine, upon seeing 'var location ...', would redefine the built-in. That's broken per ECMA and I can't believe that IE does it. So I think anyone who wants var location to shadow the predefined property is SOL. sr=brendan@mozilla.org. /be
Updated•23 years ago
|
Attachment #58095 -
Flags: superreview+
Assignee | ||
Comment 10•23 years ago
|
||
Fix checked in, fingers crossed in hope that this actually helps more than it breaks :-)
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 11•22 years ago
|
||
*** Bug 138303 has been marked as a duplicate of this bug. ***
Comment 12•21 years ago
|
||
Hi. I'm trying to understand this bug, and why this fix was necessary to break DOM Level 0 compatibility. I am sure there are good reasons, but there needs to be some documentation or something. It's frustrating because code that is documented on just about every textbook out there, including David Flannagan's JavaScript the Definitive Guide, uses the vanilla without the window. This also breaks scripts that onced worked with 3rd Gen browsers and Internet Explorer upto the current version 6.
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•