3
나는 div
안에 모든 어린이들을 특정 클래스로 묶어야하는 컨테이너 인 form-el
입니다. 각 양식 요소에서이 div
을 반복하는 대신에 from-el
을 감싸는 것을 허용하고 싶습니다. 모든 요소를 반복하여 다른 HTML 태그 안에 감쌀 수 있습니까? 이를 달성하기장식 요소 <content>
// Markup
<form-el>
<input-el label="name" type="text" />
<span>This must also be wrapped</span>
</form-el>
// Would produce
<form>
<div class="form-field">
<label>name</label>
<input type="text" name="name" />
</div>
<div class="form-field">
<span>This must also be wrapped</span>
</div>
</form>
// Where '<div class="form-field">' is produced by 'from-el'
고마워요. 하지만 폴리머 요소를 래핑하려고하면 첫 번째 요소 만 표시됩니다. http://jsbin.com/sadexakoyuco/1/edit –
사용자 정의 요소는 무효가 될 수 없습니다. ' '을 사용할 수 없으며 ' '을 사용해야합니다. –
@ScottMiles 어떻게하면 래퍼를 얻을 수 있습니까? 템플릿이 스탬프 처리되어 비동기 적으로 배포되기 때문에'this.updateWrappers();가 실행 된 직후'this.shadowRoot.querySelectorAll ("div")'에 대한 참조를 얻을 수 없다. 단순화 된 경우 http://jsbin.com/zuxiqo/1/edit에서 작동하지만 경쟁 조건을 피하는 것으로 충분합니까? – tomalec