Skip to content

DOM Exception 12 on append inside each loop #98

Description

@sammorrisdesign-zz
                    $(".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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions