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

Browsers supported #33

Open
benmccann opened this issue May 7, 2020 · 3 comments
Open

Browsers supported #33

benmccann opened this issue May 7, 2020 · 3 comments

Comments

@benmccann
Copy link

Hi, I'm wondering what browsers are supported. The README said that polyfills are not required, but also says that template strings are used, which are not supported in IE. So does that mean this library doesn't support IE? Are there other APIs used that would affect browser support?

@jon49
Copy link
Contributor

jon49 commented Jun 2, 2020

You can look in the code and see what APIs are used and look them up. Template strings are only used if you want to use them. I just create a template tag and work off of it. Let me know what you find.

@benmccann
Copy link
Author

Template tag is not supported in IE 11 either

@Freak613
Copy link
Owner

Freak613 commented Jun 7, 2020

Yes, that's true, template tags are not supported in IE and would require a polyfill.
It was used simply for convenience of writing multiline strings and library in current state would be fine with input of just any single string.

I'll update readme on browser support, and will think how to get it.

Given small library footprint, desired functionality can be achieved with:

export function h(str) {
  const template = str
    .replace(/>\n+/g, '>')
    .replace(/\s+</g, '<')
    .replace(/>\s+/g, '>')
    .replace(/\n\s+/g, '<!-- -->')
  compilerTemplate.innerHTML = template
  const content = compilerTemplate.content.firstChild
  compile(content)
  return content
}

However, I have to check other parts, as some low-level DOM API can also be unsupported in IE.

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