【发布时间】:2016-01-17 21:18:31
【问题描述】:
在 html、body 和 head 标签中放置自定义元素 decls 的原因是什么?
喜欢https://github.com/PolymerElements/polymer-starter-kit的我的列表和我的问候:
<html><head><link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-styles/typography.html">
</head><body><dom-module id="my-list">
<template>
....
</template>
</dom-module>
<script src="my-list.js"></script>
以下,没有html、body和head
<dom-module id="my-list">
<template>
....
</template>
<script>
.....
</script>
</dom-module>
工作得很好。自定义元素周围是否有一些规范或任何需要 html 和 body 的东西?
【问题讨论】:
-
仅供参考:
</head>只是关闭 HTML 文档的头部。元素基本上在<body>内。 -
@user656449 能否请您也编辑一下代码,否则会造成混乱。
-
ups,对不起,在问题中添加了错误的标签。但它是一个组件,而不是一个“普通”页面,是吗?只需将“dom-module”作为顶级标签,它就可以正常工作。那么为什么是 html 和 body?
-
好的,从第三次尝试开始,问题最终看起来应该是这样的
-
我仍然很不确定这个问题到底是什么。
标签: html polymer polymer-1.0