File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ module.exports = core => {
6262 StyleSheetList . prototype . __proto__ = Array . prototype ;
6363
6464 StyleSheetList . prototype . item = function item ( i ) {
65- return this [ i ] ;
65+ return Object . prototype . hasOwnProperty . call ( this , i ) ? this [ i ] : null ;
6666 } ;
6767
6868 core . StyleSheetList = StyleSheetList ;
Original file line number Diff line number Diff line change @@ -475,6 +475,13 @@ exports.tests = {
475475 t . done ( ) ;
476476 } ,
477477
478+ "StyleSheetList.prototype.item returns null on index out of bounds" : t => {
479+ const document = jsdom . jsdom ( ) ;
480+ t . strictEqual ( document . styleSheets [ 0 ] , undefined ) ;
481+ t . strictEqual ( document . styleSheets . item ( 0 ) , null ) ;
482+ t . done ( ) ;
483+ } ,
484+
478485 "setting background to null works correctly (GH-1499)" : t => {
479486 const document = jsdom . jsdom ( ) ;
480487 document . body . innerHTML = `<div id="ctrl" style="background:#111;border:1px"></div>` ;
You can’t perform that action at this time.
0 commit comments