/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/bento/util/template.js
18 строк
517 B
Dhruv Manek
✨ Mustache service for Bento standalone components (#37584)
11 фев 2022, 22:06
Не верифицирован
11 фев 2022, 22:06
6f88c91
Код
Авторство
О чём код?
import {escapeCssSelectorIdent} from '#core/dom/css-selectors'; /** * @param {HTMLElement} element * @param {string} attribute * @return {HTMLTemplateElement|null} */ export function getTemplate(element, attribute = 'template') { if (element.hasAttribute(attribute)) { const id = element.getAttribute(attribute); return Boolean(id) ? element.ownerDocument.querySelector( `template#${escapeCssSelectorIdent(id)}` ) : null; } return element.querySelector('template'); }