qwery icon indicating copy to clipboard operation
qwery copied to clipboard

DOM Exception 12 on append inside each loop

Open sammorrisdesign-zz opened this issue 11 years ago • 0 comments

                    $(".block--discussion-thread").each(function(el) {
                        if (!$(this).hasClass("block--discussion-thread--checked")) {
                            if (typeof $(this)[0].children[4] !== "undefined") {
                                var blockID = "#" + $(this)[0].children[3].id;
                                var numOfComments = $(this)[0].children.length - 4;
                                if (numOfComments == 1) {
                                    $(this).addClass("block--discussion-thread--orphan");
                                } else {
                                    $(blockID).append("<div class='more more--comments'><span class='more__label' data-icon='&#xe050;'>" + numOfComments + " more replies</span></div>");
                                }
                            }
                        }
                        $(this).addClass("block--discussion-thread--checked");
                    });

This piece of code fails with a DOM exception 12 error on the line starting $(blockID).append

Console error references line 88 in Qwery 4.0, reverting to older 3.x version fixes this.

sammorrisdesign-zz avatar Jul 01 '14 15:07 sammorrisdesign-zz