3-10 Global Polymer settings 全局Polymer设置

layout: default
type: guide
shortname: Docs
title: Global Polymer settings
subtitle: Developer guide

Document-level global Polymer settings can be set by creating a Polymer object on window before importing the Polymer library:
文档级别全局Polymer设置能够在导入Polymer库前被在window上创建一个Polymer对象来设置
<html>
<head>
<meta charset="utf-8">
<script src="components/webcomponentsjs/webcomponents-lite.js"></script>
<script>
window.Polymer = window.Polymer || {};
window.Polymer.dom = 'shadow';
</script>


<link rel="import" href="elements/my-app.html">
</head>
<body>

  ...

Note: The full version of webcomponents.js includes a stub version
of the Polymer function. Setting the value this way avoids overwriting the
stub.
{: .alert .alert-info }

Settings can also be switched on the URL query string:

http://myserver.com/test-app/index.html?dom=shadow

Available settings:

  • dom—options:
    • shady. All local DOM is rendered using shady DOM, even where shadow DOM is supported (current default).
    • shadow. Local DOM is rendered using shadow DOM where supported (this will be the default in the future).
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容