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

Add TextEncoder.prototype.encoding getter, fallback to property assigment for engines without getter support such as IE8 #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JakeChampion
Copy link

Fixes #12

…nment for engines without getter support such as IE8

Fixes #12
@anonyco
Copy link
Owner

anonyco commented Jun 30, 2020

Sorry. I have been busy over the past few day, but I am looking forwards to a more open week where I can work on this.

  • You are correct that TextEncoder.prototype.encoding is required per the specs, and your implementation of this property is spot-on specs-compliant. Excellent work.
  • I love your dedication and enthusiasm. Thank you for being considerate enough to rebuild the project before submitting the PR. However,
  • I don't want merge this pull request. FastestSmallestTextEncoder is designed to cut reasonable corners in order to reduce its size. You might see a condition checking the TextEncoder.prototype.encoding property in a compliance test suite, but no real production code is going to check this property.
  • The purpose of TextEncoder.prototype.encoding was for future possible encodings support, but the specs have killed any hope of that happening in the future.

Because I respect your perseverance so much, I'm willing to create a 3rd flavour of this library which boasts complete specs compliance if you want me to. The reason why the main flavour will not recieve these fixes is because the fixes will likely double the file size, which is unacceptable to me. Otherwise, I am going to have to let this good pull request go. Thank you for the effort you have put into this.

Sincerely,
Jack Giffin

@anonyco
Copy link
Owner

anonyco commented Jun 30, 2020

Additionally, this library does not support streaming and ignoreBOM, FYI.

@JakeChampion
Copy link
Author

A fully spec compliant implementation would be amazing to see :-) we are looking to add TextEncoder and decoder polyfills to https://polyfill.io and were hoping to use an already written polyfill rather than authoring it by myself. I'm happy to help with testing across browsers and for spec compliance on any polyfills you write :-)

@anonyco
Copy link
Owner

anonyco commented Jul 2, 2020

I'll begin work on a fully specs compliant version. However, please let me say my two cents:

  • I like the concept on polyfill.io, however
  • I dislike the execution of this service and think it should offer an alternative version.

The reason for why is because

  • In my mind, Polyfills should be decently performant and reasonably small. People using old browsers are already having a crummy experience browsing the web, so why make their experience even more miserable?

In my mind,

  • A good polyfilling service should offer an alternative polyfill bundle that might not be 100% specs-compliant, but works perfectly in all real-world use cases.
  • For example, Object.defineProperty might be required on TextEncoder for specs-compliance, but real-world code will never know the difference because no real-world code for-in iterates over a TextEncoder or tries to set read-only properties.

Thank you for hearing my two cents. I'll begin work on a new flavour of this polyfill.

@anonyco anonyco added the it's happening I am working on it right now! label Jul 2, 2020
@anonyco anonyco reopened this Aug 15, 2020
@anonyco
Copy link
Owner

anonyco commented Aug 15, 2020

Not so fast. I have not been devoting as much time to this project as I should, but I am trying hard to find time for it, and am bound to find time eventually because things are looking to clear up in the next 3 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
it's happening I am working on it right now!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing encoding property
2 participants