google.load('visualization'…) bug?

2019-09-06 00:14发布

When I call the following from an already-rendered page, the document.body appears to be removed from the DOM:

google.load('visualization', '1', {packages:['table']});

The problem can be viewed in a fiddle:

http://jsfiddle.net/4FcUg/

Note that I initially thought it might be related to Mootools, but in the fiddler, I can pick any framework and see the same behavior, leading me to suspect a bug in Google' s jsapi.

Am I missing something simple?

1条回答
爷、活的狠高调
2楼-- · 2019-09-06 00:32

Thanks for the suggestion, Vikram. Sure enough, any callback will prevent the 'disappearance' of the body:

google.load('visualization', '1', {packages:['corechart'], callback:function() { alert('!'); }});

For a demo of the 'bug' and the 'working' version, see:

http://jsfiddle.net/4FcUg/4/

查看更多
登录 后发表回答