admin管理员组文章数量:1287274
I have seen statements like below in many D3 examples. However, I can't find out what it means. In particular, I don't know what this self
variable refers to. Additionally, does this manifest some sort of D3 magic/convention or is it just an ad-hoc thing? Thank you very much.
d3.select(self.frameElement).style("height", height + "px");
BTW, here is the example where I copied the above statement.
I have seen statements like below in many D3 examples. However, I can't find out what it means. In particular, I don't know what this self
variable refers to. Additionally, does this manifest some sort of D3 magic/convention or is it just an ad-hoc thing? Thank you very much.
d3.select(self.frameElement).style("height", height + "px");
BTW, here is the example where I copied the above statement.
Share Improve this question asked Mar 17, 2014 at 6:15 JBTJBT 8,75621 gold badges68 silver badges107 bronze badges2 Answers
Reset to default 7self
: if not redefined (typically as copy of this
) than it is window
object which always points to window
. So they can be used interchangeably.
window.frameElement
: Returns the element (such as <iframe> or <object>) in which the window is embedded, or null if the window is top-level.
See Window.frameElement
On this example I found the following ment:
// Hack to make this example display correctly in an iframe on bl.ocks
本文标签:
版权声明:本文标题:javascript - d3: what is the self as in d3.select(self.frameElement).style("height", height + "px& 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741223586a2361435.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论