j-ulrich / jquery-simulate-ext

jQuery simulate extended
https://j-ulrich.github.io/jquery-simulate-ext/
Other
146 stars 48 forks source link

Use .focus() instead of target.focus() for quirks test #18

Closed ragulka closed 10 years ago

ragulka commented 10 years ago

I am using this plugin in node with jsdom and using the plain target throws an error in bililiteRange.js:

TypeError: Cannot call method 'replace' of null

It traces back to the line I have changed in the commit. I guess the issue is that pure dom elements do not automatically get a focus method with jsdom. However, using the jquery object eliminates this problem.

j-ulrich commented 10 years ago

Just looked into the jQuery code and basically, they surround the call to .focus() with some try{} catch{} so I think this is fine. Thanks for the fix!