0
當我通過grunt-contrib-jasmine運行這個Jasmine規範時,出現錯誤TypeError:試圖分配給只讀屬性。指向哪裏設置selectedIndex屬性行:爲什麼Jasmine會在設置selectedIndex時抱怨'試圖分配給只讀屬性'?
it('does something', function() {
setFixtures('<select id="selectId"><option>Text</option></select>');
var selectDOM = document.getElementById('selectId');
selectDOM.selectedIndex = 0;
// stripped some code here...
});
有誰知道我在這裏失蹤? 我用phantomjs v1.9.8,grunt-cli v0.1.13 and grunt-contrib-jasmine v0.9.2。
在這個例子中,我沒有犯錯,所以這個例子會運行正常。如果您似乎有同樣的問題,請在下面閱讀我的答案。 – RSeidelsohn