Closed Bug 654137 Opened 10 years ago Closed 10 years ago
.top should not be replaceable
If my server is not up, here my testfiles
Component: General → DOM
Product: Firefox → Core
QA Contact: general → general
It's readonly, but replaceable in Gecko (see section B of the link you cite). What do other browsers do here?
Looks like it's not replaceable in Safari, Chrome, Opera. jst, how do you feel about changing that in Gecko?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: window.top is NOT readonly and can be set manually → window.top should not be replaceable
OS: Windows 7 → All
Hardware: x86 → All
Version: unspecified → Trunk
(In reply to comment #3) > Looks like it's not replaceable in Safari, Chrome, Opera. I think this is a small flaw of implementation of that spec in gecko. It has its reason why it should not be replaceable ... could be misused in some ways i guess (opening pages in hidden iframes without having affected to be replaced from that iframes by setting the top-attribute to null or anything else than the real top). i dont have made up a lot of thoughts, just hat do give it a try when it came into my mind ;)
Well, the reason to have properties replaceable is so that this sort of script could work: top = document.body.offsetTop; top += 5; myDiv.style.top = top + "px"; Note that this script will fail in non-Gecko browsers right now, whereas if the first line started with |var| then it will work in all browsers.
(In reply to comment #5) > Well, the reason to have properties replaceable is so that this sort of script > could work: > > top = document.body.offsetTop; > top += 5; > myDiv.style.top = top + "px"; > > Note that this script will fail in non-Gecko browsers right now, whereas if the > first line started with |var| then it will work in all browsers. good example, but due to "all" other browsers are handling "top" as non-replaceable i think gecko is just handling it wrong in replacing special properties. i personally think its bad-practice to use keywords as variable-names, especially without explicit using "var" (got in a lot of trouble already by using other persons code). currently im starting to think if it is possible to change other properties like document or something like that ...
Assignee: nobody → Ms2ger
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla6
Expectedly, this caused a test failure. Unexpectedly, it caused only one.
Attachment #530938 - Flags: review?(bzbarsky)
Comment on attachment 530938 [details] [diff] [review] Patch v1 r=me
Attachment #530938 - Flags: review?(bzbarsky) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Documentation updated: https://developer.mozilla.org/en/DOM/window.top Mentioned on Firefox 6 for developers.
You need to log in before you can comment on or make changes to this bug.