Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"element instanceof HTMLElement" throws "HTMLElement is not defined" #271

Open
leifoolsen opened this issue Aug 27, 2016 · 2 comments
Open

Comments

@leifoolsen
Copy link

leifoolsen commented Aug 27, 2016

Hello,
I just upgraded jsdomify from version 2.1.0 to 3.0.0 and code working in 2.1.0 now fails. Maybe there is something from JsDom that is not propery loaded in 3.0.0?

Testcase:

import jsdomify from 'jsdomify';
const describe = require('mocha').describe;
const it = require('mocha').it;
const expect = require('chai').expect;

describe('jsdomify-3-failing-test', () => {

  const fixture = `
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Fixture</title>
</head>
<body>
  <div id="mount">
  </div>
</body>
</html>`;

  const acceptOnlyHTMLElelemnt = element => {
    if(element) {
      if (!(element instanceof HTMLElement)) {
        throw new TypeError('element parameter must be an HTMLElement');
      }
    }
  };

  before ( () => {
    jsdomify.create(fixture);
  });

  after ( () => {
    jsdomify.destroy();
  });

  it('should accept HTMLElement', function () {
    const element = document.querySelector('#mount');

    expect(() => {
      acceptOnlyHTMLElelemnt(element);
    }).to.not.throw(Error);

    expect(() => {
      acceptOnlyHTMLElelemnt('bar');
    }).to.throw(TypeError);
  });
});
@dmatteo
Copy link
Owner

dmatteo commented Sep 6, 2016

Hey @leifoolsen , I've noticed JSDOM pushed a few changes and fixes to HTMLCollections, so I've updated our dependency as well.

Can you pull down jsdomify@3.1.0 and see if you still have this issue?

@leifoolsen
Copy link
Author

Still the same error: "ReferenceError: HTMLElement is not defined"
jsdom-9.5.0, jsdomify-3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants