Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.removeChild removes parent from document id's #42

Closed
ejones opened this issue Oct 7, 2010 · 1 comment
Closed

Node.removeChild removes parent from document id's #42

ejones opened this issue Oct 7, 2010 · 1 comment

Comments

@ejones
Copy link
Contributor

ejones commented Oct 7, 2010

The following for-loop in the definition of Node.removeChild seems to be using this, i.e., the parent node, in places where the child was intended:

    for (var i=0;i < this._children.length;i++) {
      if (this._children[i] === oldChild) {
        found=true;
        this._children.remove(i,i);
        oldChild._parentNode = null;

        if (this.id) {
          if (this._ownerDocument._ids) {
            this._ownerDocument._ids[this.id] = null;
            delete this._ownerDocument._ids[this.id];
          }
        }

        if (this.nodeType === this.DOCUMENT_NODE) {
          if (this._documentElement === oldChild) {
            this._documentElement = null;// force a recalculation
          }
        }

        return oldChild;
      }
    }

In particular, it removes the parent from the document's id list, effectively hiding it from getElementById

@ejones
Copy link
Contributor Author

ejones commented Oct 9, 2010

removeChild - remove child's id, not parent's, from document. closed by 04119c8.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant