Take the 2-minute tour ×

I am trying to create a Hello World JS Metro app on Visual Studio 2011, using YUI3.

I´ve grabbed a local copy of YUI, added to a subfolder in the solution, and added a reference to yui-min.js on my default.html page:

<!-- TodoJS references -->
<script src="js/yui/build/yui/yui.js"></script>

and then at the bottom of the page I´ve added the following code:

<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function () {
        YUI().use("event", function () {
            //some code will go here..
    }, false);

When I run the code, I get a null ref error on YUI(). I do get intelissense working in Visual Studio (e.g YUI().add), so the reference seems to be OK, but YUI is not found on run time. Any tips?

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

I would try the steps outlined in How To: Create a Windows 8 Metro App with JS and YUI 3

share|improve this answer
I've seen this post, but I would like to use YUI loader, so I don't have to regenerate a new combo file every time I need a new YUI module. –  rod May 9 '12 at 23:53
add comment

I take it that you've got the issue fixed. However if you'd like to use the YUI components such as "calendar", "tabview" etc, you'll have to modify a few files that include innerHTML calls and wrap the added html content with toStaticHTML.

There were only a couple of files(dom-base.js, yui.js) that needed to be modified and most of the components worked fine(including the "datatable" and "charts" widgets), with the exception of the rich text editor. The nice thing about YUI is that it supports touch gestures for a majority of the components, for example panning "datatable" works correctly.

share|improve this answer
add comment

Your Answer


