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

doctype is always null even when DocumentType is present as a child node #277

Closed
RyanHanekamp opened this issue Aug 16, 2021 · 1 comment · Fixed by #301
Closed

doctype is always null even when DocumentType is present as a child node #277

RyanHanekamp opened this issue Aug 16, 2021 · 1 comment · Fixed by #301
Labels
bug Something isn't working spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/
Milestone

Comments

@RyanHanekamp
Copy link

RyanHanekamp commented Aug 16, 2021

Applies to 0.7.0 and 0.6.0.

The parsed document has a DTD of

<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.1 20151215//EN" "https://jats.nlm.nih.gov/publishing/1.1/JATS-journalpublishing1.dtd">

The DocumentType is in the list of child nodes:

Document {
...
  childNodes: {
...
    '2': DocumentType {
      name: 'article',
      nodeName: 'article',
      publicId: '"-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.1 20151215//EN"',
      systemId: '"https://jats.nlm.nih.gov/publishing/1.1/JATS-journalpublishing1.dtd"',
      lineNumber: 2,
      columnNumber: 1,
      previousSibling: [Text],
      nextSibling: [Element],
      parentNode: [Circular],
      ownerDocument: [Circular]
    },

However, document.doctype === null. (Not undefined.)

-Ryan

@karfau karfau added the needs investigation Information is missing and needs to be researched label Aug 18, 2021
@karfau
Copy link
Member

karfau commented Aug 18, 2021

@RyanHanekamp Thank you for reporting it.

I took the liberty to add some formatting to your description, please check that the reported domtype matches your input. (I removed to backslashes that I assume you put in to avoid them being treated as HTML.)

I will have a closer look into it in the next days and add information along the way.

@karfau karfau added bug Something isn't working spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/ and removed needs investigation Information is missing and needs to be researched labels Aug 19, 2021
@karfau karfau changed the title dom.doctype is null, but the document has a child node of DocumentType doctype is always null even when DocumentTypeis present as a child node Aug 20, 2021
@karfau karfau changed the title doctype is always null even when DocumentTypeis present as a child node doctype is always null even when DocumentType is present as a child node Aug 20, 2021
karfau added a commit that referenced this issue Aug 24, 2021
karfau added a commit that referenced this issue Aug 26, 2021
* fix: Add doctype when parsing from string

fixes #277

* Update test/parse/doctype.test.js

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>

* Update test/parse/doctype.test.js

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>

Co-authored-by: Chris Brody <chris.brody+brodybits@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants