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

fix: Only use HTML rules if mimeType matches #338

Merged
merged 25 commits into from Oct 8, 2022

Commits on Feb 28, 2022

  1. feat: Add DOMImplementation.createHTMLDocument

    - always set `Document.type` and `Document.contentType`
    - `Document.createElement` properly HTML casing and (X)HTML namespacing
    
    https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument
    https://dom.spec.whatwg.org/#dom-document-createelement
    karfau committed Feb 28, 2022
    Copy the full SHA
    a405d39 View commit details
    Browse the repository at this point in the history
  2. refactor: Create HTML document from DOMHandler

    when `mimeType` is `text/html`.
    The `mimeType` can now optionally be passed to the `DOMHandler` constructor.
    Documented `DOMHandler` constructor and all properties.
    
    - For XML documents the XHTML and SVG mime types are preserved as expected.
    - `Document.documentURI` is no longer initialized with the undocumented `Locator.systemId` value.
    - Deprecate `DOMParserOptions.domBuilder` since state would be preserved between calls to `DOMParser.parseFromString` which can have unexpected side effects, especially since we are now using the `DOMHandler` to manage the mimeType and defaultNamespace.
    karfau committed Feb 28, 2022
    Copy the full SHA
    b5d1061 View commit details
    Browse the repository at this point in the history
  3. feat: Use minimal Object.assign ponyfill

    to be able to copy from options provided to `DOMParser`
    karfau committed Feb 28, 2022
    Copy the full SHA
    a6b72cf View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    fb752f0 View commit details
    Browse the repository at this point in the history
  5. refactor: Copy DOMParserOptions locator and xmlns to instance

    Instead of accessing `this.options` in `DOMParser.parseToString`,
    the default values are now applied in the constructor.
    Since the locator passed to `options` is no longer being modified,
    the type of the option was changed to boolean.
    There is no change in behavior in this commit,
    since truthy and falsy values are accepted as well.
    karfau committed Feb 28, 2022
    Copy the full SHA
    97c9f8d View commit details
    Browse the repository at this point in the history
  6. refactor: Copy DOMParserOptions normalizeLineEndings to instance

    Instead of accessing `this.options` in `DOMParser.parseToString`,
    the default values are now applied in the constructor.
    karfau committed Feb 28, 2022
    Copy the full SHA
    175aa0a View commit details
    Browse the repository at this point in the history
  7. refactor: Copy DOMParserOptions errorHandler to instance

    Instead of accessing `this.options` in `DOMParser.parseToString`,
    use `this.errorHandler`.
    karfau committed Feb 28, 2022
    Copy the full SHA
    6579add View commit details
    Browse the repository at this point in the history
  8. fix: Replace DOMParserOptions domBuilder by domHandler

    which points to a class instead of an instance and is only meant for internal testing.
    
    BREAKING CHANGE: If you used to configure `DOMParserOptions.domBuilder`.
    You might be able to configure the `domHandler` instead, but should be avoided.
    This is only there for testing purposes.
    karfau committed Feb 28, 2022
    Copy the full SHA
    581a9ef View commit details
    Browse the repository at this point in the history
  9. refactor: Drop DOMParser.options property

    All options are now taken care of by the constructor and are available as individual properties.
    Most are marked as `readonly`, some are `private`.
    
    BREAKING CHANGE: If you used `DOMParser.options` after creating an instance.
    You can still read the individual properties from the instance,
    but there is no longer a way to mutate them, so you need to really pass the required options when constructing them.
    karfau committed Feb 28, 2022
    Copy the full SHA
    dea863f View commit details
    Browse the repository at this point in the history
  10. feat: Correctly handle all case modifications

    in HTML docs or namespaces
    karfau committed Feb 28, 2022
    Copy the full SHA
    f305328 View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    980734f View commit details
    Browse the repository at this point in the history
  12. Copy the full SHA
    380851d View commit details
    Browse the repository at this point in the history
  13. Copy the full SHA
    aae7654 View commit details
    Browse the repository at this point in the history
  14. Copy the full SHA
    0b032bb View commit details
    Browse the repository at this point in the history
  15. style: Format code

    karfau committed Feb 28, 2022
    Copy the full SHA
    8626514 View commit details
    Browse the repository at this point in the history
  16. Copy the full SHA
    fef1d79 View commit details
    Browse the repository at this point in the history
  17. docs: Tweak doc comments

    karfau committed Feb 28, 2022
    Copy the full SHA
    52acd24 View commit details
    Browse the repository at this point in the history
  18. Copy the full SHA
    5fd4e1b View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2022

  1. fix(sax): Handle raw text elements in HTML

    and drop warning for boolean attributes in HTML
    karfau committed Mar 6, 2022
    Copy the full SHA
    ceff927 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    dc62bf5 View commit details
    Browse the repository at this point in the history
  3. style: Format test code

    karfau committed Mar 6, 2022
    Copy the full SHA
    bbe7790 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    ae2c7da View commit details
    Browse the repository at this point in the history
  5. fix(dom): Serialize according to document type

    BREAKING CHANGE: The following methods no longer allow a (non spec compliant) boolean argument to toggle "HTML rules":
    - `XMLSerializer.serializeToString`
    - `Node.toString`
    - `Document.toString`
    karfau committed Mar 6, 2022
    Copy the full SHA
    9b46871 View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    48f49be View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    1b88b30 View commit details
    Browse the repository at this point in the history