好吧,我終於弄清楚我的代碼的哪個部分導致異常。您可以閱讀初始文章here.初始文章中的代碼缺少實際引起異常的部分(手動訂閱viewPortData
可觀測)。顯然,我做錯了某種方式...這裏是代碼:NS_ERROR_XPC_BAD_CONVERT_JS:無法轉換JavaScript參數arg 0 [nsIDOMWindow.getComputedStyle](Followup)
self.viewPortData = ko.observable();
self.viewPortData.subscribe(function (newValue) {
var viewPort = $('#metro-view-port');
if (viewPort && newValue) {
self.fadeInOut(viewPort, newValue);
}
});
self.fadeInOut = function (domObject, newContent) {
if (newContent) {
var currentContent = domObject.html();
if (currentContent) {
var wrappedContent = $(currentContent);
wrappedContent.fadeOut(400, function() {
wrappedContent.empty();
domObject.html(newContent).hide().fadeIn(400);
});
} else {
domObject.html(newContent).hide().fadeIn(400);
}
}
};
那麼我哪裏出錯了?
證實 - 當我從要附加的代碼中移除html註釋時,錯誤消失了。 – zergussino