AMP

https://amp.dev/zh_cn/

PWA

AMP Playground

https://playground.amp.dev/?runtime=amp4email

<!doctype html>
<html 4email>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<style amp4email-boilerplate>body{visibility:hidden}</style>
<style amp-custom>
h1 {
margin: 1rem;
}
</style>
</head>
<body>
<h1>Hello, I am an AMP EMAIL!</h1>
</body>
</html>

custom-element

https://github.com/ampproject

<!doctype html>
<html amp lang="en">
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<title>Hello, AMPs</title>
<link rel="canonical" href="https://amp.dev/zh_cn/documentation/guides-and-tutorials/start/create/basic_markup/">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Open-source framework for publishing content",
"datePublished": "2015-10-07T12:02:41Z",
"image": [
"logo.jpg"
]
}
</script>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
</head>
<body>
<h1>Welcome to the mobile web</h1>
</body>
</html>

Chrome Devtools

https://developers.google.com/web/updates/2020/03/devtools

Grid Layout



/**
* Copyright 2017 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ import {ElementStub, stubbedElements} from '../element-stub';
import {createCustomElementClass} from '../custom-element';
import {extensionScriptsInNode} from '../element-service';
import {reportError} from '../error';
import {userAssert} from '../log'; /**
* @param {!Window} win
* @return {!Object<string, typeof ../base-element.BaseElement>}
*/
function getExtendedElements(win) {
if (!win.__AMP_EXTENDED_ELEMENTS) {
win.__AMP_EXTENDED_ELEMENTS = {};
}
return win.__AMP_EXTENDED_ELEMENTS;
} /**
* Registers an element. Upgrades it if has previously been stubbed.
* @param {!Window} win
* @param {string} name
* @param {typeof ../base-element.BaseElement} toClass
*/
export function upgradeOrRegisterElement(win, name, toClass) {
const knownElements = getExtendedElements(win);
if (!knownElements[name]) {
registerElement(win, name, toClass);
return;
}
if (knownElements[name] == toClass) {
// Already registered this instance.
return;
}
userAssert(
knownElements[name] == ElementStub,
'%s is already registered. The script tag for ' +
'%s is likely included twice in the page.',
name,
name
);
knownElements[name] = toClass;
for (let i = 0; i < stubbedElements.length; i++) {
const stub = stubbedElements[i];
// There are 3 possible states here:
// 1. We never made the stub because the extended impl. loaded first.
// In that case the element won't be in the array.
// 2. We made a stub but the browser didn't attach it yet. In
// that case we don't need to upgrade but simply switch to the new
// implementation.
// 3. A stub was attached. We upgrade which means we replay the
// implementation.
const {element} = stub;
if (
element.tagName.toLowerCase() == name &&
element.ownerDocument.defaultView == win
) {
tryUpgradeElement_(element, toClass);
// Remove element from array.
stubbedElements.splice(i--, 1);
}
}
} /**
* This method should not be inlined to prevent TryCatch deoptimization.
* @param {Element} element
* @param {typeof ../base-element.BaseElement} toClass
* @private
* @noinline
*/
function tryUpgradeElement_(element, toClass) {
try {
element.upgrade(toClass);
} catch (e) {
reportError(e, element);
}
} /**
* Stub extended elements missing an implementation. It can be called multiple
* times and on partial document in order to start stubbing as early as
* possible.
* @param {!./ampdoc-impl.AmpDoc} ampdoc
*/
export function stubElementsForDoc(ampdoc) {
const extensions = extensionScriptsInNode(ampdoc.getHeadNode());
extensions.forEach((name) => {
ampdoc.declareExtension(name);
stubElementIfNotKnown(ampdoc.win, name);
});
} /**
* Stub element if not yet known.
* @param {!Window} win
* @param {string} name
*/
export function stubElementIfNotKnown(win, name) {
const knownElements = getExtendedElements(win);
if (!knownElements[name]) {
registerElement(win, name, ElementStub);
}
} /**
* Copies the specified element to child window (friendly iframe). This way
* all implementations of the AMP elements are shared between all friendly
* frames.
* @param {!Window} parentWin
* @param {!Window} childWin
* @param {string} name
*/
export function copyElementToChildWindow(parentWin, childWin, name) {
const toClass = getExtendedElements(parentWin)[name];
registerElement(childWin, name, toClass || ElementStub);
} /**
* Registers a new custom element with its implementation class.
* @param {!Window} win The window in which to register the elements.
* @param {string} name Name of the custom element
* @param {typeof ../base-element.BaseElement} implementationClass
*/
export function registerElement(win, name, implementationClass) {
const knownElements = getExtendedElements(win);
knownElements[name] = implementationClass;
const klass = createCustomElementClass(win);
win['customElements'].define(name, klass);
} /**
* In order to provide better error messages we only allow to retrieve
* services from other elements if those elements are loaded in the page.
* This makes it possible to mark an element as loaded in a test.
* @param {!Window} win
* @param {string} elementName Name of an extended custom element.
* @visibleForTesting
*/
export function markElementScheduledForTesting(win, elementName) {
const knownElements = getExtendedElements(win);
if (!knownElements[elementName]) {
knownElements[elementName] = ElementStub;
}
} /**
* Resets our scheduled elements.
* @param {!Window} win
* @param {string} elementName Name of an extended custom element.
* @visibleForTesting
*/
export function resetScheduledElementForTesting(win, elementName) {
if (win.__AMP_EXTENDED_ELEMENTS) {
delete win.__AMP_EXTENDED_ELEMENTS[elementName];
}
} /**
* Returns a currently registered element class.
* @param {!Window} win
* @param {string} elementName Name of an extended custom element.
* @return {?function()}
* @visibleForTesting
*/
export function getElementClassForTesting(win, elementName) {
const knownElements = win.__AMP_EXTENDED_ELEMENTS;
return (knownElements && knownElements[elementName]) || null;
}

refs



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


随机推荐

  1. Autofac for AutoMapper

    我一直在做的事情.NET 开发已经有一段时间了.有时人们问我,为什么我仍然觉得它有趣.答案很简单: 我是超级 d.r.y.如果你不熟悉这个术语,你应该查一下,但它基本上意味着你应该总是尝试应用那些可以 ...

  2. LOJ10201

    题目描述 原题来自:Codeforces Round #400 B. Sherlock 有了一个新女友(这太不像他了!).情人节到了,他想送给女友一些珠宝当做礼物. 他买了n  件珠宝.第i  件的价 ...

  3. Grafana Prometheus系统监控Redis服务

    Grafana Prometheus系统监控Redis服务 一.Grafana Prometheus系统监控Redis服务 1.1流程 1.2安装redis_exporter 1.3配置prometh ...

  4. linux系统权限管理拓展:特殊权限

    文件与目录权限设置不止读.写.执行这些,还有所谓的特殊权限,由于特殊权限会拥有一些"特权": 1 2 3 4 本章内容 SUID SGID SBIT 文件扩展权限ACL 1.SUI ...

  5. UML——RUP(Rational Unified Process)

    一.宏观导图 二.论细节 RUP(Rational Unified Process)统一软件过程,是指要达到一个指定的目标而采取的一些系列有序的步骤,其目的是高效.准时地提交一个满足业务需求的软件产品 ...

  6. (5)U盘安装Linux系统

    1.前期准备 使用 U 盘安装 Linux 系统,需要准备以下工具: 大容量的U盘(安装 CentOS 6.x 系统,U 盘容量至少 8 G): UltraISO 工具,用来制作 U 盘启动盘.除此之 ...

  7. 小白搭建WNMP详细教程---NGINX安装与设置

    一.Nginx下载 Nginx (engine x) 是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP服务器.Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Ramble ...

  8. mysql高级day4

    Mysql高级-day04 1. MySql中常用工具 1.1 mysql 该mysql不是指mysql服务,而是指mysql的客户端工具. 语法 : mysql [options] [databas ...

  9. linux(4)Linux 文件内容查看

    查看文件内容总览 cat 由第一行开始显示文件内容 tac 从最后一行开始显示,可以看出 tac 是 cat 的倒着写! nl 显示的时候,顺道输出行号! more 一页一页的显示文件内容 less ...

  10. Codeforces Round #671 (Div. 2)

    比赛链接:https://codeforces.com/contest/1419 A. Digit Game 题意 给出一个 $n$ 位数,游戏规则如下: 1-indexed Raze标记奇数位 Br ...