Skip to content

Deleting a custom window property does not work #1622

@vntw

Description

@vntw

Hi,

the #jsdom IRC channel told me to open an issue about this:

I'm unable to (completely) delete a window property that I added myself. The value will remain the same.

Failing test case:

specify("Create, modify and delete custom window property", () => {
  const window = jsdom.jsdom().defaultView;

  assert.equal(window.XXX, undefined);
  assert.equal('XXX' in window, false);

  window.XXX = 1;
  assert.equal(window.XXX, 1);

  window.XXX = 2;
  assert.equal(window.XXX, 2);

  delete window.XXX;
  assert.equal(window.XXX, undefined); // Fails here
  assert.equal('XXX' in window, false);
});

Test Result:

  1) jsdom/miscellaneous Create, modify and delete custom window property:
     AssertionError: expected 2 to equal undefined

Working in Chrome DevTools:

screen shot 2016-10-04 at 15 28 49

Tested with 9.5.0 and master#7b11f2b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions