/
githubmirror
/
amphtml
Обзор
Документация
Войти
/
githubmirror
/
amphtml
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/core/document/format.js
27 строк
608 B
Ryan Cebulko
♻️ Migrate most of #core to pass TS typechecking (#37141)
09 дек 2021, 21:22
Не верифицирован
09 дек 2021, 21:22
58a1c29
Код
Авторство
О чём код?
/** * Checks that the document is of an AMP format type. * @param {Array<string>} formats * @param {Document} doc * @return {boolean} */ function isAmpFormatType(formats, doc) { const html = doc.documentElement; const isFormatType = formats.some((format) => html.hasAttribute(format)); return isFormatType; } /** * @param {Document} doc * @return {boolean} */ export function isAmp4Email(doc) { return isAmpFormatType(['⚡4email', 'amp4email'], doc); } /** * @param {Document} doc * @return {boolean} */ export function isAmphtml(doc) { return isAmpFormatType(['⚡', 'amp'], doc); }