-
Notifications
You must be signed in to change notification settings - Fork 205
Adds browser support info #117
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
Conversation
* getting-started: adds a small note about loading the polyfills * browsers: adds section to Tools and workflows describing browser support, building JS (mainly links to Building section), and loading polyfills.
A couple of comments on this. On first glance, I think we need to deduplicate some of this material with Building for Production: specifically the Build requirements and Supporting older browsers sections. At present, neither is really complete. For example, this section has a bunch of hands-on information about loading polyfills, but doesn't mention the Babel polyfills which need to be bundled separately and imported before the WC polyfills. I think there are a couple of options here, including placing the conceptual information about browser support in this page, and all the hands-on information in the Building section. |
Also not sure whether we want to add the extra details about the polyfill support module to getting started; but it definitely needs to be in the hands-on sections of Building. Also: have you tested this with the WC polyfill bundle (as opposed to the loader)? I seem to recall that this did not work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relative URLs => absolute to cope with eleventy's odd URL scheme.
Co-authored-by: Arthur Evans <arthure@google.com>
Co-authored-by: Arthur Evans <arthure@google.com>
Co-authored-by: Arthur Evans <arthure@google.com>
|
||
| Browser | Module Specifiers | Modern JS | Web Components | | ||
|:---------|:---------------------:|:--------------:|:--------------------:| | ||
| Chrome | 90 | 80 | 67 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is "Chrome 90"? Did you mean "80"?
I think Chrome has supported modules since 61: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is referencing import maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| Browser | Module Specifiers | Modern JS | Web Components | | ||
|:---------|:---------------------:|:--------------:|:--------------------:| | ||
| Chrome | 90 | 80 | 67 | | ||
| Safari | build | 13 | 10 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Safari has supported modules for a while
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modern JS here includes modules. Module specifiers refers to import maps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIU the "module specifiers" column was trying to separate "bare module specifier" support (aka import maps) into its own "it works natively except on older browsers" category.
I'm uncomfortable with this framing; import maps are very so nascent, it feels disingenuous to represent it like this. AFAIK Chrome is only shipping inline import maps, meaning you need (a) a tool to generate the import map based on your dependencies, and (b) a tool to inline this into your HTML. Do either of these exist, and do we know them to work?
Since we don't provide any guidance here, I think it would be better for now to be less obtuse and say something like "Lit is published with bare packages specifiers, which need to be translated into URLs to be loadable in the browser. The import maps [link] spec just starting to be implemented will give the browsers the ability to do this on their own, we will provide guidance and tools once this feature is more common in browsers. Until then, you will need to use a toolchain that rewrites package specifiers to URLs, see ... [cross-reference] for more details."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see... yeah, I'd rather remove this column for now, and just note that we require resolving bare module specifiers with a tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
|
||
The following table lists browser versions that support the features on which Lit relies. For the browsers not supporting these features natively, they are supported either via polyfills or by producing a compatible build. | ||
|
||
| Browser | Module Specifiers | Modern JS | Web Components | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd list the ES feature level we use so it's a little more clear what we mean instead of "modern". And remove "specifiers" - I think we just mean module support at all, yeah?
| Browser | Module Specifiers | Modern JS | Web Components | | |
| Browser | JS Modules | ES2020 | Web Components | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
| Chrome | 90 | 80 | 67 | | ||
| Safari | build | 13 | 10 | | ||
| Firefox | build | 72 | 63 | | ||
| Edge (Chromium) | build | 80 | 79 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be roughly the same as Chrome, yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refined.
| Edge 14-18 | build | build | polyfill | | ||
| Internet Explorer 11 | build | build | polyfill | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"build" isn't reading to me clearly here. What if we listed the version like other cells, but colored the cell differently if support is via compilation or a polyfill.
| Edge 14-18 | build | build | polyfill | | |
| Internet Explorer 11 | build | build | polyfill | | |
| Classic Edge | 15 | 15 | 15 | | |
| Internet Explorer | 11 | 11 | 11 | |
I'm not sure how to add classes to markdown tables though. We could use HTML tables.
I think we should like Edge support as 15 and up if that's what we test.
|
||
Lit uses modern Javascript features like modules, classes, and other recent syntax additions. All of these features can be transpiled into ES5 code which runs on older browsers. See [Building](/guide/tools/building/) for more information about how to build application and Lit component code into ES5. | ||
|
||
When compiling code to ES5, browsers with native web components require a small polyfill, the`custom-elements-es5-adapter.js`. Using a single ES5 build for all browsers is useful in static serving environments. Important note: the ES5 adapter must come before the web components polyfills, if any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't call the adapter a polyfill, and I think we can describe what it does quickly enough. Also, I'm not sure about the second sentence.
When compiling code to ES5, browsers with native web components require a small polyfill, the`custom-elements-es5-adapter.js`. Using a single ES5 build for all browsers is useful in static serving environments. Important note: the ES5 adapter must come before the web components polyfills, if any. | |
When compiling code to ES5, browsers with native web components require a small adapter, the`custom-elements-es5-adapter.js` that lets ES5 extend built-in classes. Important note: the ES5 adapter must be loaded before the web components polyfills, if any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's useful anywhere you only want to serve one version to all of your users. That includes anyone who's using static hosting and doesn't want to mess around with feature detection on the client before loading all of the JS.
Co-authored-by: Justin Fagnani <justinfagnani@google.com>
Co-authored-by: Justin Fagnani <justinfagnani@google.com>
order: 7 | ||
--- | ||
|
||
Lit works and is supported on the last-two major versions of Chrome, Firefox, Edge, and Safari, and other browsers based on those rendering engines. Lit is also supported on IE11 and "classic" Edge. Lit uses modern JavaScript and web platform features like web components, JavaScript modules, and classes. Lit supports modern browsers natively, and older browsers like IE11 via compilers and polyfills. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like "Lit works and is supported on the last-two major versions" is a little ambiguous around the meaning of "supported" ... does this mean "SLA" or "works"? It's a bit in tension with this statement and the table below:
For the browsers not supporting these features natively, they are supported either via polyfills or by producing a compatible build.
Which implies browsers not supporting these features natively are still supported.
I mainly just don't want the first sentence to be off-putting if it's misunderstood as "Lit only works on the last two major versions of modern browsers."
Can we clarify what this exactly means by saying something like:
Lit supports modern browsers natively, and older browsers like IE11 via compilers and polyfills. We run continual integration tests to ensure Lit works on the last two major versions of Chrome, Firefox, Edge, and Safari, as well as IE11 and "classic" Edge 15. Older versions of evergreen browsers will likely work just fine with proper compilation and polyfills based on the features they support, although we do not test the full back catalog of these browsers.
Let's reconcile with the info in #211. |
Note, old content is still in the Tools section but needs to be integrated into the Tools and Workflows overview.
Should be integrated now, PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with a few things to think about before committing.
| Safari | 10-12 | <10 | | ||
| Firefox | 63-71 | <63 | | ||
| Edge | 79 | | | ||
| Edge "classic" | | 15-18 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the lower bound of 15 relevant? Is it just <18 or do we not run below 15?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Load the `custom-elements-es5-adapter.js` after any Babel polyfills and before web components, like this: | ||
|
||
```html | ||
<script src="nomodule/src/babel-polyfills-nomodule.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nomodule/src/babel-polyfills-nomodule.js
referred to a custom polyfill bundle that we showed how to make on the old lit docs.
Above, I'm just listing you need core-js
, regenerator-runtime
, maybe systemjs
, and then on the concrete page the plugin just does all that for you, so we don't show exactly what to load for those now.
So it's probably confusing to reference that URL because it's not mentioned anywhere. Should maybe just make this some sort of generic URL that implies its the polyfills you need? aka path/to/polyfills/you/need.js
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
#### Setting web components polyfill options | ||
|
||
By default, the individual polyfill for a given feature is disabled on browsers that natively support that feature. For testing purposes, you can force the polyfills on for browsers that have native support. You can force the polyfills on by adding a JavaScript snippet before you import the polyfills: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth showing this?
I think for most polyfills, users don't think of testing with them on/off because they should be transparent. So I think this assumes the user understands that they (particularly ShadyCSS) is imperfect, which is probably not apparent to a new reader.
While it's a benefit to us to test on Chrome, that's mostly for debugging; users should still test on the browsers they intend to support. So maybe this is too much detail? Or else I think it needs a little more context, i.e.
While the web compoents polyfills strive to match the spec in a performant way, there are some infidelities particularly around styling. We recommend ensuring you test with polyfills both on and off, either on the browsers that need them, or by forcing them on.
But that sounds a little scary, and my next question would be, where exactly are the infidelities...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included that paragraph with a link to the limitations.
Fixes https://github.com/Polymer/internal/issues/1198
This section has been incorporated into the Build > Requirements documentation.