我的webcomponent没有显示

时间:2012-10-24 07:53:48

标签: html5 web-component

我的web组件未显示。 Chrome确实支持这个吗?

我使用is属性并使用Javascript尝试了它。两者都不起作用。

指数(头):

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="js/jquery/jqueryMobile/jquery.mobile-1.2.0.css" />
        <script src="js/jquery/jquery-1.8.2.js"></script>
        <script src="js/jquery/jqueryMobile/jquery.mobile-1.2.0.js"></script>
        <link rel="components" href="x-mycomp.html"/>
        <script>
            var el = document.createElement('x-mycomp');
            alert(el); // shows: [object HTMLUnkownElement]
        </script>

索引(正文):

    <div id="page1" data-role="page">
        <div is="x-mycomp"></div>

    </div>

的x mycomp.html:

<element extends="div" name="x-mycomp">
    <template>
        <content>
            <div>
                <div data-role="header">
                    <div>
                        Log in
                    </div>
                    <a id="bt_register" data-role="button">register</a>
                </div>
                <div data-role="content">
                    <form>
                        <input id="username" placeholder="username" type="text"/>
                        <input id="password" placeholder="password" type="password"/>
                        <a id="bt_login" data-role="button">Log in</a>
                    </form>
                </div>
            </div>
        </content>
    </template>
</element>

1 个答案:

答案 0 :(得分:0)

Chrome目前尚不支持此功能。所以在那之前,这是正确的答案。