This is a migrated thread and some comments may be shown as answers.

Unable to get property 'parentNode' of undefined or null reference

3 Answers 365 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 02 May 2014, 09:49 AM
Hi,

I wasn't sure where to post this so I put it in General. I hope that that's ok! Anyway, I am facing the following issue. The line that is throwing the exception is bolded below. We are on version 2014.1.403.45 of Telerik. We are using a mix of Rad controls but I suspect that the issue relates to a RadComboBox.

Let me know if you require additional information and I will provide it no problem.

Thanks,
John.


disposeDomEvents:function(){var f=this.get_wrapper(),e=this._owner,d=e.get_inputDomElement(),c=e.get_imageDomElement();
$telerik.removeExternalHandler(f,"mouseover",this._onTableHoverDelegate);
$telerik.removeExternalHandler(f,"mouseout",this._onTableOutDelegate);
this._onTableHoverDelegate=null;
this._onTableOutDelegate=null;
if(d.parentNode){$telerik.removeExternalHandler(d.parentNode,"mouseup",this._onInputCellMouseUpDelegate);
this._onInputCellMouseUpDelegate=null;
}if(c){$telerik.removeHandler(c,"click",this._onImageClickDelegate);
this._onImageClickDelegate=null;
}}

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 02 May 2014, 03:54 PM
To provide more context, the exception is being thrown here. In bold.

/* START Telerik.Web.UI.ComboBox.Views.ClassicView.js */
(function (a, b) {
    if (!b.RadComboBox.Views) {
        b.RadComboBox.Views = {};
    }
    b.RadComboBox.Views.Classic = function (c) {
        b.RadComboBox.makeEventHandler(this);
        this._owner = c;
        this._enabled = c.get_enabled(), this._wrapper = $telerik.getFirstChildByTagName(c.get_element(), "table", 0);
        a(c.get_element()).find("caption").hide();
    };
    b.RadComboBox.Views.Classic.prototype = {
        initialize: function () {
            this.get_wrapper().style.display = "";
            this.initDomEvents();
        },
        initDomEvents: function () {
            var f = this.get_wrapper(),
                e = this._owner,
                d = e.get_inputDomElement(),
                c = e.get_imageDomElement();
            this._onTableHoverDelegate = Function.createDelegate(this, this._onTableHover);
            $telerik.addExternalHandler(f, "mouseover", this._onTableHoverDelegate);
            this._onTableOutDelegate = Function.createDelegate(this, this._onTableOut);
            $telerik.addExternalHandler(f, "mouseout", this._onTableOutDelegate);
            this._onInputCellMouseUpDelegate = Function.createDelegate(this, this._onInputCellClick);
            $telerik.addExternalHandler(d.parentNode, "mouseup", this._onInputCellMouseUpDelegate);
            this._onImageClickDelegate = Function.createDelegate(this, this._onImageClick);
            $telerik.addHandler(c, "click", this._onImageClickDelegate);
        },
        dispose: function () {
            this.disposeEvents();
            this.disposeDomEvents();
            this._nulifyEventExpandos();
        },
        disposeDomEvents: function () {
            var f = this.get_wrapper(),
                e = this._owner,
                d = e.get_inputDomElement(),
                c = e.get_imageDomElement();
            $telerik.removeExternalHandler(f, "mouseover", this._onTableHoverDelegate);
            $telerik.removeExternalHandler(f, "mouseout", this._onTableOutDelegate);
            this._onTableHoverDelegate = null;
            this._onTableOutDelegate = null;
            if (d.parentNode) {
                $telerik.removeExternalHandler(d.parentNode, "mouseup", this._onInputCellMouseUpDelegate);
                this._onInputCellMouseUpDelegate = null;
            }
            if (c) {
                $telerik.removeHandler(c, "click", this._onImageClickDelegate);
                this._onImageClickDelegate = null;
            }
        },
        disable: function () {
            this.withWrapper(function (c) {
                a(c).attr("class", "rcbDisabled");
            });
        },
        enable: function () {
            this.withWrapper(function (c) {
                c.removeAttribute("class");
            });
        },
        repaint: function () {
            var i = this._owner,
                f = i.get_element(),
                g = a(f).find(".rcbLabel").get(0),
                k = this.get_wrapper(),
                j = k.getElementsByTagName("tr")[0];
            a(j).toggleClass("rcbReadOnly", i.get_readOnly());
            if (g) {
                var e = f.offsetWidth,
                    h = g.offsetWidth;
                tableWidth = e - h;
                if (tableWidth == 0) {
                    var c = f,
                        d = c.style.width;
                    if (d.indexOf("%", 0) == -1) {
                        tableWidth = this._measureTableWidthWithLabel();
                    }
                }
                if (tableWidth > 0) {
                    var l = $telerik.getMargin(k, Telerik.Web.BoxSide.Right);
                    if (tableWidth - l >= 0) {
                        tableWidth -= l;
                    }
                }
                k.style.width = tableWidth + "px";
            }
            k.style.display = "";
            if (i._fakeInput) {
                i._repaintFakeInput();
            }
        },
        focus: function (c) {
            this.withWrapper(function (d) {
                setTimeout(function () {
                    a(d).attr("class", "rcbFocused");
                }, 0);
            });
        },
        blur: function (c) {
            this.withWrapper(function (d) {
                d.removeAttribute("class");
                if ($telerik.isIE) {
                    a(d).removeAttr("class");
                }
            });
        },
        withWrapper: function (c) {
            var d = this.get_wrapper();
            if (d != null) {
                c.apply(this, [d]);
            }
        },
        _nulifyEventExpandos: function () {
            var c = this._owner;
            c._inputDomElement._events = null;
            c._inputDomElement = null;
            c._imageDomElement._events = null;
            c._imageDomElement = null;
            if (this._wrapper) {
                this._wrapper.events = null;
                this._wrapper = null;
            }
        },
        _measureTableWidthWithLabel: function () {
            var i = this._owner,
                f = i.get_element(),
                g = a(f).find("label").get(0).cloneNode(false),
                d = this.get_wrapper().cloneNode(false),
                c = f.cloneNode(false);
            c.style.position = "absolute";
            c.style.top = "-1000px";
            c.style.left = "-1000px";
            c.appendChild(g);
            c.appendChild(d);
            document.body.appendChild(c);
            var l = document.createElement("td"),
                m = document.createElement("tr");
            m.appendChild(l);
            var k = document.createElement("tbody");
            k.appendChild(m);
            d.appendChild(k);
            var e = c.offsetWidth,
                h = g.offsetWidth,
                j = e - h;
            document.body.removeChild(c);
            return j;
        },
        _onTableHover: function (c) {
            if (!this._owner.get_enabled()) {
                return;
            }
            var d = this.get_wrapper();
            if (d != null && d.className != "rcbFocused") {
                d.className = "rcbHovered";
            }
        },
        _onTableOut: function (c) {
            if (!this._owner.get_enabled()) {
                return;
            }
            var d = this._wrapper;
            relatedTarget = this._owner._getRelatedTarget(c);
            if (!relatedTarget) {
                return;
            }
            while (relatedTarget && relatedTarget.nodeType !== 9) {
                if (relatedTarget.parentNode && relatedTarget.parentNode == d) {
                    return;
                }
                relatedTarget = relatedTarget.parentNode;
            }
            if (d != null && d.className == "rcbHovered") {
                d.className = "";
            }
        },
        _onInputCellClick: function (c) {
            this.trigger("inputClick", c);
        },
        _onImageClick: function (c) {
            this.trigger("buttonClick", c);
        },
        get_wrapper: function () {
            return this._wrapper;
        }
    };
})($telerik.$, Telerik.Web.UI);
0
Accepted
Plamen
Telerik team
answered on 07 May 2014, 08:09 AM
Hi John,

Thank you for providing the source of the error.

Unfortunately we were not able to replicate it neither locally nor in any of our on-line demos. Would you please elaborate it a little bit by sharing the code connected with RadComboBox that you are using and the steps to observe the error?

Please share the browsers in which you are observing it.

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
John
Top achievements
Rank 1
answered on 08 May 2014, 09:29 AM
Hi Plamen,

Thanks for you reply. I also posted regarding another issue. I think that it may be related to this one. I will focus on the other issue first and hopefully it may solve this one also. If not, I will post back and provide code etc.

Cheers,
John.





Tags
General Discussions
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or