Thress: OffsetTop seems to increase for each object trs.
Neikirk: I also tried – instead of +.
Souto: You want relative to the top of the page?
Gentleman: Zumba_addict: that’s just calling a function with its receiver set to the current “this”
Espree: Undrinkablesoup, do the clientRect and use do***ent.body.scrollTop
Bradeen: Thanks Gentleman. I put a debugger and ran over the code, the this grew
Bumford: Add them together and that should give you the absolute position of the element
Hadwin: Looks like that code is what implements the inheritance
Orn: GreenJello: Same thing seems to happen with that. Sigh.
Bartolotta: As soon as I scroll, it becomes offset.
Schetrompf: Only works when it has not scrolled.
Fude: This is really making my skin crawl.
Johnosn: I tried with – as well. Wrong.
Huisman: RectObject.top + do***ent.body.scrollTop
Malachi: RectObject.top – do***ent.body.scrollTop
Attles: Both work when it has not scrolled.
Hardgrave: But as soon as it scrolls, the wrong values start being calculated.
Fruits: GreenJello: Turns out that do***ent.body.scrollTop never changes when I scroll.
Lansdell: That’s why it calculates wrongly.
Merrick: But why doesn’t it? Isn’t it scrollTop?
Gavin: So “this” inside a function will have the scope of that function unless we substitute this to another variable like self and use self instead
Kalkman: This and scope are totally separate concepts
Kalkman: Usually we call “this” the context, just to avoid confusion
Kalkman: Zumba_addict: read this article: http://perfectionkills.com/know-thy-reference/
Kalkman: Explains exactly how “this” works
Ruesch: I thought scope and context were the same
Kalkman: Scope = the variables that you have access to
Gentleman: Actually usually we call “this” the “receiver” to avoid confusion
Gentleman: The word “context” is what causes confusion.
Kalkman: Aka the current function and all parent wrapping functions
Kalkman: I am only going based on what I actually see in the real world, and I’ve never once seen the word receiver used. many docs use context and scope
Sandau: Maybe lexical context but not execution context
Oballe: I updated the code and the value got overwritten. This is now a real world scenario. What is the ideal way to address this? http://jsfiddle.net/dqggvjrj/1/
Spellane: I’m referring to the age property I added in Cl***C
Klammer: So am I right that Cl***C shouldn’t have the same property name? or should I put another property that doesn’t exist from the parent?
Kalkman: Code runs top to bottom zumba_addict
Kalkman: Setting this.age =10; and then setting this.age = 12; means this.age will be 12
Kalkman: Which is what you’re doing in Cl***C
Hefferman: GreenJello: Isn’t it window.scrollY?
Felicia: The question goes for everyone else too.
Kalkman: You are setting this.age = 10; and then you are immediately after that setting this.age = 12;
Uriostejue: That’s what I am seeing on the output. It gets overwritten by cl***B
Liskai: Maybe do***ent.body.scrollTop is legacy and discontinued or something?
Pestoni: Undrinkablesoup, is the window scrolling or is it the table?
Zema: GreenJello: The browser window is scrolling, obviously.
Molgard: I am instantiating cl***C first which calls cl***B
Angelotti: Tables can scroll, it’s not uncommon :-
Cannada: Cl***C is a child of cl***B
Tomaino: Height: 100px; overflow-y: scroll;