Apache Cordova的工具:JQueryMobile将输入标签包含在head标签中? [英] Tools for Apache Cordova: JQueryMobile wraps input tags inside a head tag?

查看:299
本文介绍了Apache Cordova的工具:JQueryMobile将输入标签包含在head标签中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio 2013 Ultimate更新4,适用于Apache Cordova CTP 3.0的工具,用于构建Windows Phone 8.1



我正在搜索帮助/ workarounds / magic处理以下内容:



从一个空白的ApacheCordova模板应用程序开始,它运行罚款。

添加按钮输入 - 一切仍然是罚款



但是包括JQuery和JQuery.mobile,并且< p> 也不会在模拟器或设备上运行时呈现< input>

 < body> 
< p>您好,您的申请已准备就绪!< / p>
< input type ='button'value =''/>

<! - Cordova引用,这是添加到您的应用程序时,它的构建。 - >
< script src =cordova.js>< / script>
< script src =scripts / platformOverrides.js>< / script>

< script src =scripts / jquery-2.1.1.js>< / script>
< script src =scripts / jquery.mobile-1.4.5.js>< / script>
< script src =scripts / index.js>< / script>
< / body>

查看index.html的DOM Explorer,我们看到为什么:我们的 < p> 和< input> 已包装在< head> 当JQM做增强。

 < body class =ui-mobile-viewport ui-overlay-a> 
< head tabindex =0class =ui-page ui-page-theme-a ui-page-activestyle =min-height:667px; data-url =/ www / index.html>
< p>您好,您的申请已准备就绪!< / p>
< head>< input type =buttonvalue =>< / head>

<! - Cordova引用,这是添加到您的应用程序时,它的构建。 - >
< script src =cordova.js>< / script>
< script src =scripts / platformOverrides.js>< / script>< script src =scripts / winstore-jscompat.js>< / script&

< script src =scripts / jquery-2.1.1.js>< / script>
< script src =scripts / jquery.mobile-1.4.5.js>< / script>
< script src =scripts / index.js>< / script>
< / head>

< head class =ui-loader ui-corner-all ui-body-a ui-loader-default>< / head>
< body class =ui-loader ui-corner-all ui-body-a ui-loader-default>< / body&
< / body>

没有使用JQuery Mobile,有没有人知道如何停止一旦输入标记被引入标记,JQM就开始包装在标记中。

解决方案

JQM与winstore-jscompat不兼容。 js。
因此,您可以注释掉< script src =scripts / platformOverrides.js>< / script> 或修改winstore-jscompat。 p>

足以注释掉winstore-jscompat.js中的以下行:



  / * cleansePropertySetter(innerHTML,function(propertyDescriptor,target,elements){empty(target); for(var i = 0,len = elements.length; i< len; i ++){target.appendChild(elements [i] );}}); * /  


Visual Studio 2013 Ultimate update 4, Tools for Apache Cordova CTP 3.0, building for Windows Phone 8.1

I'm searching for help/workarounds/magic to deal with the following:

Start with a blank ApacheCordova template app, it runs "fine".
Add a button input -- everything is still "fine"

But then include JQuery and JQuery.mobile and neither the <p> nor the <input> are rendered when running on the emulator or the device.?.?.?.???

<body>
<p>Hello, your application is ready!</p>
<input type='button' value='' />

<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>

<script src="scripts/jquery-2.1.1.js"></script>
<script src="scripts/jquery.mobile-1.4.5.js"></script>
<script src="scripts/index.js"></script>
</body>  

Looking at the DOM Explorer for index.html, we see why: our <p> and <input> have been wrapped in <head> when JQM did the enhancement.

<body class="ui-mobile-viewport ui-overlay-a">
    <head tabindex="0" class="ui-page ui-page-theme-a ui-page-active" style="min-height: 667px;" data-url="/www/index.html">
        <p>Hello, your application is ready!</p>
        <head><input type="button" value=""></head>

        <!-- Cordova reference, this is added to your app when it's built. -->
        <script src="cordova.js"></script>
        <script src="scripts/platformOverrides.js"></script><script src="scripts/winstore-jscompat.js"></script>

        <script src="scripts/jquery-2.1.1.js"></script>
        <script src="scripts/jquery.mobile-1.4.5.js"></script>
        <script src="scripts/index.js"></script>
    </head>

    <head class="ui-loader ui-corner-all ui-body-a ui-loader-default"></head>
    <body class="ui-loader ui-corner-all ui-body-a ui-loader-default"></body>
</body>

Short of not using JQuery Mobile, does anyone have an idea how to "stop" this from happening? Once an input tag is introduced into the markup, JQM starts wrapping in head tags.

解决方案

JQM is incompatible with winstore-jscompat.js. So you can comment out <script src="scripts/platformOverrides.js"></script> or modify the winstore-jscompat.

It's enough to comment out the following lines in winstore-jscompat.js:

/*
cleansePropertySetter("innerHTML", function (propertyDescriptor, target, elements) {
  empty(target);
  for (var i = 0, len = elements.length; i < len; i++) {
    target.appendChild(elements[i]);
  }
});
*/

这篇关于Apache Cordova的工具:JQueryMobile将输入标签包含在head标签中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆