jQuery and Windows 8 JavaScript Metro Style Apps

前端 未结 9 1380
小蘑菇
小蘑菇 2021-02-02 11:31

Can jQuery be used in Windows 8 Metro-style apps developed using the JavaScript API? I\'m looking at the samples, and there\'s a lot of standard DOM manipulation like doc

9条回答
  •  既然无缘
    2021-02-02 11:38

    tl;dr : you can use jQuery 1.7+, but it's not (yet?) fully integrated when markup modification is involved.


    Quote from the Dev Center (msdn)

    Using jQuery

    You can use jQuery in your Windows Store app using JavaScript, but only versions 1.7 and later. We recommend always using the latest version.

    That means that it will work, but you will encounter some non-standard behaviors as listed in the HTML and DOM API changes list (msdn)

    There are exceptions mentioned when setting the innerHtml property (among others : Making HTML safer) if there is unsafe markup, but this is non-blocking and the simple fact of loading the jQuery library (1.8.2) will trigger a few.

    As mentioned before, you do need to use a local copy of the library (no CDN).

提交回复
热议问题