Coder Social home page Coder Social logo

Comments (5)

eligrey avatar eligrey commented on August 23, 2024

Wouldn't exactly say sometimes. Every single current release of every major browser supports the API. Also, if by "add those" you mean save references to the methods and put them on a new URL object, that is not going to work either, as URL is also used as a native function for URL parsing. (new URL(url_here).origin etc.)

Simply put, URL is a global variable that should not ever be redefined unless you're polyfilling it, as I do in Blob.js. Whatever Polymer needs it for, it can use a differently named global variable if it's not using it for the sole purpose of polyfilling it.

from url.

arv avatar arv commented on August 23, 2024

You are right, all browsers we care about have URL.createObjectURL and URL.revokeObjectURL.

We already feature detect and keep the original URL if it can be new'ed.

The PR makes sure that we add the statics if the builtin is not newable.

from url.

eligrey avatar eligrey commented on August 23, 2024

Oh, so Polymer uses URL for it's URL processing abilities. Do you realize that document.createElement("a").href = url is an equivalent superset of new URL(url)?

See my new URL(...) polyfill for more information. You will notice that origin is manually handled, as some very old browsers don't support that natively.

from url.

arv avatar arv commented on August 23, 2024

@eligrey That is mostly correct. There are some issues with it. And it is also slower, since it needs a new document and uses <base>. I took the <a> approach in arv/DOM-URL-Polyfill but we decided to go down the current route and base this on the reference implementation of the spec.

from url.

eligrey avatar eligrey commented on August 23, 2024

Ah, thanks for linking me to that. I wasn't aware of that polyfill, mostly as mine focuses on the blob aspects.

from url.

Related Issues (12)

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.