pg.myfunc = function(){
var i = 1, j = 2;
this.selected = 1;
xx.newObject = this.parentElement;
...
What is xx.newObject = this.parentElement; doing?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s the same as
this.parentNode: it gives you the node that containsthisas a childNode.thiswill bepg, presumably an Element of some kind;this.parentNodewill be the Element that contains it, or thedocumentobject ifpgis the root element.parentElementis a non-standard IE extension. Since IE also supports the standard propertyparentNode,parentElementshould never be used.Alternatively, maybe it’s just an arbitrary object with a property called
parentElement, in which case it could be anything at all. There’s no real way to tell from that code, but it would be unusual to be setting arbitrary properties likemyfuncon an Element node.