I'm trying to integrate LitElement in a project for work. It works on all browsers, except on a modified Firefox which has customElements
disabled. Is there any way to get around this? If I turn in on in about:config
Asking users to activate it is not an option.
The component code:
import {html, LitElement, property} from 'lit-element';
class MyElement extends LitElement {
@property({type: String}) myProp = 'stuff';
render() {
return html`
<p>Hello World</p>
${this.myProp}
`;
}
}
customElements.define('my-element', MyElement);
LitElement uses Custom Elements for easy inclusion in web pages, and Shadow DOM for encapsulation. There's no new abstraction on top of the web platform.
If Custom Elements are disabled, I wouldn't expect LitElement to work.
However, you could try a polyfill for customElements
like https://github.com/webcomponents/custom-elements – while it's meant for browsers that don't support customElements
, I imagine it could also work in a situation where the feature is disabled.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.