8000 fix!: preserve DOCTYPE internal subset by shunkica · Pull Request #498 · xmldom/xmldom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix!: preserve DOCTYPE internal subset #498

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

Merged
merged 121 commits into from
Jul 10, 2023
Merged

Conversation

shunkica
Copy link
Collaborator
@shunkica shunkica commented Jun 15, 2023

Add support for parsing the internal subset of a DOCTYPE and saving it as a string in DocumentType.internalSubset.

BREAKING CHANGE: Many documents that were previously accepted by xmldom, esecially non well-formed ones are no longer accepted. Some issues that were formerly reported as errors are now a fatalError.

fixes #117, #497

Spec: XML DOM L2 Core

8000
@shunkica

This comment was marked as outdated.

@shunkica

This comment was marked as outdated.

@karfau karfau added the spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/ label Jun 15, 2023
@karfau
Copy link
Member
karfau commented Jun 15, 2023

Thx, I will have a closer look over the weekend.

@shunkica

This comment was marked as outdated.

@karfau karfau changed the title Parse the internal subset of a DOCTYPE feat: preserve internal subset of a DOCTYPE Jun 16, 2023
@karfau karfau changed the title feat: preserve internal subset of a DOCTYPE feat: preserve internal subset of DOCTYPE Jun 16, 2023
@karfau
Copy link
Member
karfau commented Jul 9, 2023

The regular expressions no longer have a chars property.
THe tests for the EntityDecl are good enough as a first step.

I managed to split the methods again, so they have a managable/testable amount of complexity.
Let me know if the approach I picked works for you. It's not a class, but I would say it's close enough.

The rino example is currently failing, so I have to fix that.

The only other thing missing is to add some unit tests for those new methods and for the new error messages, before the PR can be landed.

@karfau
Copy link
Member
karfau commented Jul 9, 2023

Rhino doesn't seem to support named groups, which we are now using to get understandable results for ExternalIDs...

But I will risk having to change the regular expression and code to make it compatible in a later PR, once it's merged and published, just to see if anybody complains.

@karfau
Copy link
Member
karfau commented Jul 9, 2023

@shunkica From my perspective I would land this. Let me know whether you agree or disagree :)

Great endurance on this contribution, and I'm looking forward to the next one :)

@shunkica
Copy link
Collaborator Author

@karfau I agree. Let's proceed with merging, and we'll tackle any issues that arise in subsequent updates.
Thanks for the hard work.

@karfau karfau changed the title fix: preserve internal subset of DOCTYPE fix!: preserve DOCTYPE internal subset Jul 10, 2023
@karfau karfau merged commit 726b471 into xmldom:master Jul 10, 2023
@karfau
Copy link
Member
karfau commented Jul 10, 2023

landed, I will be able to make a new beta release on the next 62FB tag in the upcoming days.

@karfau
Copy link
Member
karfau commented Jul 13, 2023

released as 0.9.0-beta.9 under the next version tag

@shunkica shunkica deleted the internal-subset branch July 13, 2023 10:04
karfau added a commit that referenced this pull request Oct 4, 2023
which is a regression compared to 0.8.x, most likely introduced as part
of #498

- add check to `parseDoctypeCommentOrCData`
- drop redundant and broken `Element.appendChild` implementation
- `hasInsertableNodeType` now checks for `CharacterData` nodes instead
of only text nodes
- align ParseError and DOMException in how they are extending Error
- wrap `DOMException`s in `ParseError` in sax parser
- move custom errors to own module
  - and allow current and modern constructor arguments for DOMException
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:DOM-Level-2 https://www.w3.org/TR/DOM-Level-2-Core/
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailing whitespace in processing instructions not preserved To what degree should xmldom support DTD processing support for Entity/ EntityReference?
2 participants
0