
Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.
The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.
This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.
Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.
The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.
在介绍新的 CSS 属性
contain之前,先简单介绍一下什么是页面的重绘与重排。发现之前已经描述过很多次了,可以看看这个提高 CSS 动画性能的正确姿势。
OK,下面进入本文正题,
contain为何?contain属性允许我们指定特定的 DOM 元素和它的子元素,让它们能够独立于整个 DOM 树结构之外。目的是能够让浏览器有能力只对部分元素进行重绘、重排,而不必每次都针对整个页面。contain语法看看它的语法:
{ /* No layout containment. */ contain: none; /* Turn on containment for layout, style, paint, and size. */ contain: strict; /* Turn on containment for layout, style, and paint. */ contain: content; /* Turn on size containment for an element. */ contain: size; /* Turn on layout containment for an element. */ contain: layout; /* Turn on style containment for an element. */ contain: style; /* Turn on paint containment for an element. */ contain: paint; }除去
none,取值还有 6 个,我们一个一个来看看。contain: size
contain: size: 设定了
contain: size的元素的渲染不会受到其子元素内容的影响。我开始看到这个定义也是一头雾水,光看定义很难明白到底是什么意思。还需实践一番:
假设我们有如下简单结构:
并且,借助 jQuery 实现每次点击容器添加一个
<p>Coco</p>结构:那么会得到如下结果:
可以看到,容器
.container的高度是会随着元素的增加而增加的,这是正常的现象。此刻,我们给容器
.container添加一个contain: size,也就会出现上述说的:设定了contain: size的元素的渲染不会受到其子元素内容的影响。再看看会发生什么:
正常而言,父元素的高度会因为子元素的增多而被撑高,而现在,子元素的变化不再影响父元素的样式布局,这就是
contain: size的作用。contain: style
接下来再说说
contain: style、contain: layout、contain: paint。先看看 contain: style。截止至本文书写的过程中,
contain: style暂时被移除了。嗯,官方说辞是因为存在某些风险,暂时被移除,可能在规范的第二版会重新定义吧,那这个属性也暂且放一放。
contain: paint
contain: paint:设定了
contain: paint的元素即是设定了布局限制,也就是说告知 User Agent,此元素的子元素不会在此元素的边界之外被展示,因此,如果元素不在屏幕上或以其他方式设定为不可见,则还可以保证其后代不可见不被渲染。这个稍微好理解一点,先来看第一个特性:
设定了
contain: paint的元素的子元素不会在此元素的边界之外被展示contain: paint的元素的子元素不会在此元素的边界之外被展示这个特点有点类似与
overflow: hidden,也就是明确告知用户代理,子元素的内容不会超出元素的边界,所以超出部分无需渲染。简单示例,假设元素结构如下:
我们来看看,设定了
contain: paint与没设定时会发生什么:CodePen Demo -- contain: paint Demo
设定了
contain: paint的元素在屏幕之外时不会渲染绘制通过使用
contain: paint, 如果元素处于屏幕外,那么用户代理就会忽略渲染这些元素,从而能更快的渲染其它内容。contain: layout
contain: layout:设定了
contain: layout的元素即是设定了布局限制,也就是说告知 User Agent,此元素内部的样式变化不会引起元素外部的样式变化,反之亦然。启用
contain: layout可以潜在地将每一帧需要渲染的元素数量减少到少数,而不是重新渲染整个文档,从而为浏览器节省了大量不必要的工作,并显着提高了性能。使用
contain:layout,开发人员可以指定对该元素任何后代的任何更改都不会影响任何外部元素的布局,反之亦然。因此,浏览器仅计算内部元素的位置(如果对其进行了修改),而其余DOM保持不变。因此,这意味着帧渲染管道中的布局过程将加快。
存在的问题
参考文献