問題タブ [html5-template]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - ネストされた要素 (Web コンポーネント) はそのテンプレートを取得できません
2 つのカスタム要素 (v1) を含む Web コンポーネントを使用して、1 つの要素が別の要素にネストされている簡単な例を作成しました。index.html:
app-container.html:
ツールバー.html:
しかし、toolbar.htmldocument.currentScript
は app-container.html と同じであるためquerySelector('#app-toolbar')
、id のテンプレートが見つかりませんapp-toolbar
。この問題を解決するには?
Chrome 55 でテストされた例 (ポリフィルなし)。