类型元素上不存在属性attachshadow

时间:2018-06-24 13:20:05

标签: javascript html typescript

我用html应用程序创建了一个Typescript类型的新Visual Studio项目,我试图创建一个影子dom,但是出现错误。

class Append{
    element: HTMLElement;

    constructor(element: HTMLElement) {
        this.element = element;
    }


window.onload = () => {
    var el = document.getElementById('content');
    let shadow = el.attachShadow({mode: 'open'});
}
  

类型元素上不存在属性attachshadow

1 个答案:

答案 0 :(得分:0)

并非所有元素都可以接受Shadow DOM。

在Shadow DOM v1规范的attachShadow()定义中定义了授权HTML元素的列表:

  

有效的自定义元素名称kubernetes-cli version kubernetes-cli 1.11.0 minikube version minikube version: v0.28.0 minikube start Starting local Kubernetes v1.10.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... E0717 16:19:06.522428 87230 start.go:299] Error restarting cluster: running cmd: sudo kubeadm alpha phase certs all --config /var/lib/kubeadm.yaml && sudo /usr/bin/kubeadm alpha phase kubeconfig all --config /var/lib/kubeadm.yaml && sudo /usr/bin/kubeadm alpha phase controlplane all --config /var/lib/kubeadm.yaml && sudo /usr/bin/kubeadm alpha phase etcd local --config /var/lib/kubeadm.yaml : Process exited with status 1 ================================================================================ An error has occurred. Would you like to opt in to sending anonymized crash information to minikube to help prevent future errors? To opt out of these messages, run the command: minikube config set WantReportErrorPrompt false ================================================================================ Please enter your response [Y/n]: y <article><aside><blockquote><body><div><footer><h1><h2><h3><h4><h5><h6><header><main>,{{ 1}},<nav><p>