It should not be required that elements are JSON serializable
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 718
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
When using the Shady DOM polyfill https://github.com/webcomponents/shadydom you will hit TypeError: cyclic object value when trying to return a list of elements from an execute script call (see https://github.com/webcomponents/shadydom/issues/217).
It seems that webdrivers internally use JSON.stringify on the list of elements to return, which in turn runs JSON.stringify on the elements inside the list. While this works fine for the standard case, the Shady DOM polyfill adds a __shady property to the element and at least when the element contains children, the __shady property contains cycles and cannot thus be coverted to JSON. Now this implementation detail of __shady has seemingly absolutely nothing to do with returning an element from a webdriver but because of JSON.stringify, it won't work.
Returning a single element works fine as JSON.stringify does not seem to be used in that case.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how an execute script call returns a list of elements and where JSON.stringify is applied to the returned values. Reproduce the Shady DOM case described in issue 217, comparing a list with a single element. Done means cyclic __shady data no longer prevents returning element lists while single-element returns continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, web-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100