Skip to content

Implement interface Node #16

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

Closed
17 tasks done
hepheir opened this issue Jun 2, 2021 · 1 comment · Fixed by #22 or #32
Closed
17 tasks done

Implement interface Node #16

hepheir opened this issue Jun 2, 2021 · 1 comment · Fixed by #22 or #32
Assignees
Labels
type:feature Feature requests

Comments

@hepheir
Copy link
Owner

hepheir commented Jun 2, 2021

https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-1950641247

Interface Node

IDL Definition

More
interface Node {
  // NodeType
  const unsigned short      ELEMENT_NODE       = 1;
  const unsigned short      ATTRIBUTE_NODE     = 2;
  const unsigned short      TEXT_NODE          = 3;
  const unsigned short      CDATA_SECTION_NODE = 4;
  const unsigned short      ENTITY_REFERENCE_NODE = 5;
  const unsigned short      ENTITY_NODE        = 6;
  const unsigned short      PROCESSING_INSTRUCTION_NODE = 7;
  const unsigned short      COMMENT_NODE       = 8;
  const unsigned short      DOCUMENT_NODE      = 9;
  const unsigned short      DOCUMENT_TYPE_NODE = 10;
  const unsigned short      DOCUMENT_FRAGMENT_NODE = 11;
  const unsigned short      NOTATION_NODE      = 12;

  readonly attribute  DOMString            nodeName;
           attribute  DOMString            nodeValue;
                                                 // raises(DOMException) on setting
                                                 // raises(DOMException) on retrieval
  readonly attribute  unsigned short       nodeType;
  readonly attribute  Node                 parentNode;
  readonly attribute  NodeList             childNodes;
  readonly attribute  Node                 firstChild;
  readonly attribute  Node                 lastChild;
  readonly attribute  Node                 previousSibling;
  readonly attribute  Node                 nextSibling;
  readonly attribute  NamedNodeMap         attributes;
  readonly attribute  Document             ownerDocument;
  Node                      insertBefore(in Node newChild, 
                                         in Node refChild)
                                         raises(DOMException);
  Node                      replaceChild(in Node newChild, 
                                         in Node oldChild)
                                         raises(DOMException);
  Node                      removeChild(in Node oldChild)
                                        raises(DOMException);
  Node                      appendChild(in Node newChild)
                                        raises(DOMException);
  boolean                   hasChildNodes();
  Node                      cloneNode(in boolean deep);
};

Attributes

  • readonly attribute DOMString nodeName
  • attribute DOMString nodeValue
  • readonly attribute unsigned short nodeType
  • readonly attribute Node parentNode
  • readonly attribute NodeList childNodes
  • readonly attribute Node firstChild
  • readonly attribute Node lastChild
  • readonly attribute Node previousSibling
  • readonly attribute Node nextSibling
  • readonly attribute NamedNodeMap attributes
  • readonly attribute Document ownerDocument

Methods

  • Node insertBefore(in Node newChild, in Node refChild)
  • Node replaceChild(in Node newChild, in Node oldChild)
  • Node removeChild(in Node oldChild)
  • Node appendChild(in Node newChild)
  • boolean hasChildNodes()
  • Node cloneNode(in boolean deep)
@hepheir hepheir self-assigned this Jun 2, 2021
@hepheir hepheir changed the title Implement interface Node Implement interface Node Jun 2, 2021
hepheir added a commit that referenced this issue Jun 2, 2021
also create accessor method `_nth_child_of_parent()`

#16
@hepheir hepheir added the enhancement New feature or request label Jun 2, 2021
hepheir added a commit that referenced this issue Jun 3, 2021
TODO: Implement interface `NamedNodeMap` #19
hepheir added a commit that referenced this issue Jun 3, 2021
with its accessor `_set_owner_document()`
and declared `_Document` for typing temporarily (TODO, #20)
@hepheir hepheir linked a pull request Jun 3, 2021 that will close this issue
hepheir added a commit that referenced this issue Jun 3, 2021
Implement of `Node`'s properties (#16)
@hepheir hepheir reopened this Jun 3, 2021
@hepheir
Copy link
Owner Author

hepheir commented Jun 3, 2021

아직 메소드들이 구현되지 않음

hepheir added a commit that referenced this issue Jun 4, 2021
hepheir added a commit that referenced this issue Jun 4, 2021
hepheir added a commit that referenced this issue Jun 4, 2021
the `parent_node` cannot be set directly on constructor.

since the parent node should have self in its `child_nodes`.
the binding of parent-child nodes can be done with `insert_before`, `append_child` methods.
hepheir added a commit that referenced this issue Jun 4, 2021
A `Document` object; `owner_document` must be given when creating a `Node`.

But if this node is a `Document`, `owner_document` is `None`.
hepheir added a commit that referenced this issue Jun 4, 2021
hepheir added a commit that referenced this issue Jun 4, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
failed test: `test_AppendExistingChild()`
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
hepheir added a commit that referenced this issue Jun 6, 2021
hepheir added a commit that referenced this issue Jun 6, 2021
hepheir added a commit that referenced this issue Jun 6, 2021
and its accessor methods; `Node._shallow_copy()` and `Node._deep_copy()`
hepheir added a commit that referenced this issue Jun 6, 2021
class name: `Test<Type>_<MethodName>`
method name: `test_<StateOrParams>`
@hepheir hepheir linked a pull request Jun 6, 2021 that will close this issue
@hepheir hepheir added type:others issues not falling in bug, perfromance, support, build and install or feature type:feature Feature requests and removed enhancement New feature or request type:others issues not falling in bug, perfromance, support, build and install or feature labels Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature Feature requests
Projects
None yet
1 participant