0

YUI 3 Tabview: SCRIPT5007: Unable to get value of the property 'setAttrs': object is null or undefined

Hi,

I get the message

SCRIPT5007: Unable to get value of the property 'setAttrs': object is null or undefined

in the tabview.render() line when I run the code below in IE 8, or IE 9 compatibility mode. IE 9 native mode, Firefox, etc. seem to work fine.

var tabview; YUI().use('tabview', function(Y) { var kyedtabs = document.getElementById('kyedtabs'); tabview = new Y.TabView({srcNode:kyedtabs}); tabview.render(); });

The error happens around 50% of the time only, as if it's a timing issue. Is there a way around this?

Many thanks, Mike

2 Replies
  • Hi Mike,

     YUI().use('tabview', function(Y) {
    //what ever you execute here take some time (since yui take some time to load)
    })
    

    tabview (which is your global variable) will be initialized only after YUI is loaded and initialized. all the code where you are using this tabview should stay with in YUI.use boundary.

    0
  • Thanks Singh-Markandey. I changed tabview into a local variable, and that seems to have fixed the problem. I'm not sure why though, since I wasn't actually referencing the tabview variable anywhere outside the YUI.use boundary.

    I changed the code to:

    YUI().use('tabview', function(Y) {
    var kyedtabs = document.getElementById('kyedtabs');
    var tabview = new Y.TabView({srcNode:kyedtabs});
    tabview.render();
    });

    0
This forum is locked.

Recent Posts

in YDN Documentation