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

Namespace support #143

Open
StarLederer opened this issue Sep 6, 2023 · 4 comments
Open

Namespace support #143

StarLederer opened this issue Sep 6, 2023 · 4 comments

Comments

@StarLederer
Copy link

It looks like Namespaces are not currently supported.

Namespaces are not too common but are still sometimes found useful, e.g. when working with SVG, OOXML or other non-HTML XML formats.

Would it be possible to add support for this feature and implement functions such as createAttributeNS, createElementNS, setAttributeNS etc. so that deno-dom can be used in libraries that build and manipulate exotic (or not so much) XML formats?

@StarLederer
Copy link
Author

StarLederer commented Sep 6, 2023

Might be a duplicate of #140 but that issue focuses entirely on CSS while this one entirely on the DOM

@rgbkrk
Copy link

rgbkrk commented Sep 15, 2023

Thanks for making the issue. I'm really curious about being able to run plotting libraries server side like this:

import { DOMParser } from "https://deno.land/x/deno_dom/deno-dom-wasm.ts";
import * as Plot from "npm:@observablehq/plot"

const document = new DOMParser().parseFromString(
  `<html>
    <body>
      <div id="root" />
    </body>
  </html>`,
  "text/html",
);

Plot.barY(alphabet, {x: "letter", y: "frequency"}).plot({document})

which inevitably needs createElementNS to work for SVG:

Error: createElementNS: "http://www.w3.org/2000/svg" namespace unimplemented
    at HTMLDocument.createElementNS (https://deno.land/x/[email protected]/src/dom/document.ts:244:13)
    at Element.<anonymous> (file:///Users/kai/Library/Caches/deno/npm/registry.npmjs.org/d3-selection/3.0.0/src/creator.js:16:31)
    at plot (file:///Users/kai/Library/Caches/deno/npm/registry.npmjs.org/@observablehq/plot/0.6.10/src/plot.js:156:30)
    at BarY.plotThis [as plot] (file:///Users/kai/Library/Caches/deno/npm/registry.npmjs.org/@observablehq/plot/0.6.10/src/plot.js:370:10)
    at <anonymous>:12:4: 

@b-fuze
Copy link
Owner

b-fuze commented Sep 30, 2023

Might be a duplicate of #140 but that issue focuses entirely on CSS while this one entirely on the DOM

No, it's not a duplicate of that issue. But it does coincide with that issue + #73 in general. I want to add XML support which will also require implementing namespaces as well

@StarLederer
Copy link
Author

Awesome! Really looking forward to it

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

3 participants