GithubHelp home page GithubHelp logo

Proposal: response.xml() about fetch HOT 10 CLOSED

fflorent avatar fflorent commented on August 15, 2024 6
Proposal: response.xml()

from fetch.

Comments (10)

fflorent avatar fflorent commented on August 15, 2024 2

I am not sure what this note means. As I understand, a HTML Parser could build a DOM Tree as it receives data from the request, and the intermediate state of this tree exposed to the user? (sorry if I am completely misunderstanding)

Also I don't see why exactly for XML this proposal is invalid. An XML document meaningful (and valid) once it is entirely loaded, right? And why is this valid for JSON and not for XML?

Florent

from fetch.

annevk avatar annevk commented on August 15, 2024 2

The idea is to have some amount of layering in APIs. Say you implement fetch() in JavaScript. You would not want to import an entire XML and HTML stack to do that.

from fetch.

domenic avatar domenic commented on August 15, 2024 1

See the Note

Formats you would not want a network layer to be dependent upon, such as HTML, will likely not be exposed here. Rather, an HTML parser API might accept a stream in due course.

A network layer should not be dependent on an XML parser.

from fetch.

annevk avatar annevk commented on August 15, 2024 1

@Mouvedia no, the reason for lack of that is that it would be poor architecture. It would be better to have a way to create a document from a stream and use that.

from fetch.

domenic avatar domenic commented on August 15, 2024

Sorry, didn't mean to close, that should be @annevk's prerogative.

from fetch.

annevk avatar annevk commented on August 15, 2024

JSON is low on complexity and JavaScript has JSON built-in.

from fetch.

fflorent avatar fflorent commented on August 15, 2024

I thought it would have targeted browser environments (so parsers are built in them).

Edit: If you could explain a bit further (with links maybe) so I can be more pertinent next time I propose something else, I would be thankful.

Florent

from fetch.

fflorent avatar fflorent commented on August 15, 2024

Oh, I see now. Thanks for this explanation.

Florent

from fetch.

Mouvedia avatar Mouvedia commented on August 15, 2024

@annevk so the reason for the lack of .document() (or .xml()) is the polyfill itself?
Well you don't have to worry since you have "document" listed here. And as you can see here it has been supported for quite some time now.
cf JakeChampion/fetch#204

Id say this should be reopened.

from fetch.

Mouvedia avatar Mouvedia commented on August 15, 2024

@annevk are you saying it belongs on whatwg/streams?

from fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.