bitovi / bitovi/syn

Throws error when using the click method on the document

Open
#140 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
441
Forks
254
PR merge metrics
No merged PRs in 30d

Description

@imaustink commented on [Mon May 08 2017](https://github.com/bitovi/funcunit/issues/206)

If you use `.click` like this `f.click(document)`, it throws the following error.
```
syn.js:173 Uncaught TypeError: Cannot read property 'jQuery' of undefined
at Function.jquery (https://unpkg.com/syn@0.5.0/dist/global/syn.js:173:49)
at Object.addOffset (https://unpkg.com/syn@0.5.0/dist/global/syn.js:326:30)
at init._click (https://unpkg.com/syn@0.5.0/dist/global/syn.js:515:25)
at new init (https://unpkg.com/syn@0.5.0/dist/global/syn.js:155:27)
at syn (https://unpkg.com/syn@0.5.0/dist/global/syn.js:131:20)
at Function.syn.(anonymous function) [as click] (https://unpkg.com/syn@0.5.0/dist/global/syn.js:578:24)
at HTMLDocument. (https://fiddle.jshell.net/0xxjv2o0/1/show/:49:5)
at fire (https://code.jquery.com/jquery-2.1.3.js:3094:30)
at Object.fireWith [as resolveWith] (https://code.jquery.com/jquery-2.1.3.js:3206:7)
at Function.ready (https://code.jquery.com/jquery-2.1.3.js:3412:13)
```
[JSfiddle](https://jsfiddle.net/0xxjv2o0/1/)

---

@chasenlehara commented on [Tue May 09 2017](https://github.com/bitovi/funcunit/issues/206#issuecomment-300225197)

That looks like an issue in Syn, is it not?

---

@justinbmeyer commented on [Tue May 09 2017](https://github.com/bitovi/funcunit/issues/206#issuecomment-300229114)

Try on the document.documentElement or document.body then.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure from the linked JSFiddle with f.click(document), then inspect the syn.js stack locations for jquery, addOffset, and _click. Compare the document case with document.documentElement and document.body as suggested in the discussion. Done means clicking document no longer throws the reported TypeError, with the existing behavior for element targets preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.