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

Refer to JSON serialisation/deserialisation in a uniform way #304

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 18 additions & 24 deletions webdriver-spec.html
Expand Up @@ -2928,22 +2928,11 @@ <h2>Elements</h2>
<var>element</var>’s <a>web element reference</a>.
</ol>

<p>When asked to
<dfn data-lt="serialize the element|serialization of the element">serialize the element</dfn>
<var>element</var>:

<ol>
<li><p>Let <var>object</var> be a new JSON Object with properties:
<p>The <dfn>JSON serialisation of an element</dfn>
is a JSON Object where the <a>web element identifier</a> key
is mapped to the <a>element</a>’s <a>web element reference</a>.

<dl>
<dt><a>web element identifier</a>
<dd><p>Value of <var>element</var>’s <a>web element reference</a>.
</dl>

<li><p>Return <var>object</var>.
</ol>

<p>When required to <dfn>deserialize the web element</dfn>
<p>When required to <dfn>deserialise a web element</dfn>
by a JSON Object <var>object</var> that <a>represents a web element</a>:

<ol>
Expand Down Expand Up @@ -3102,8 +3091,9 @@ <h3>Get Active Element</h3>
<li><p>Let <var>active element</var> be the <a>active element</a>
of the <a>current browsing context</a>’s <a>document element</a>.

<li><p>Let <var>active web element</var> be the
<a>serialization of the element</a> <var>active element</var>.
<li><p>Let <var>active web element</var>
be the <a data-lt="JSON serialisation of an element">JSON serialisation</a>
of <var>active element</var>.

<li><p>Return <a>success</a> with data <var>active web element</var>.
</ol>
Expand All @@ -3118,7 +3108,7 @@ <h2>Element Retrieval</h2>
Element retrieval searches are performed
using pre-order traversal of the document’s nodes
that match the provided selector’s expression.
Elements are <a data-lt="serialize the element">serialised</a>
Elements are <a data-lt="JSON serialisation of an element">serialised</a>
and returned as <a>web elements</a>.

<section>
Expand Down Expand Up @@ -3391,7 +3381,9 @@ <h3>Finding Elements to interact</h3>
<li><p>Let <var>result</var> be an empty JSON list.
<li><p>For each <var>element</var> in <var>elements returned</var>:
<ul>
<li><p><a>Serialize the element</a> <var>element</var> and append to <var>result</var>.
<li><p>Append to <var>result</var>
the <a data-lt="JSON serialisation of an element">JSON serialisation</a>
of the <var>element</var>.
</ul>
<li><p>Return <var>result</var>.
</ol>
Expand Down Expand Up @@ -4210,7 +4202,7 @@ <h3>Executing Script</h3>
but there is an assumption that WebDriver is not threadsafe.
</aside>

<p>When required to <dfn>JSON deserialize</dfn>
<p>When required to <dfn>JSON deserialise</dfn>
with argument <var>value</var>,
and optional argument <var>seen</var>,
a <a>remote end</a> must run the following steps:
Expand All @@ -4230,14 +4222,14 @@ <h3>Executing Script</h3>

<dt>If <var>value</var> is an <a>Object</a>
that <a>represents a web element</a>:
<dd><p>Return the result of running
the <a>deserialize the web element</a> algorithm with object <var>value</var>.
<dd><p>Return the <a data-lt="deserialise a web element">deserialised</a>
<a>web element</a> from <var>value</var>.

<dt>If <var>value</var> if <var>value</var> is an <a>Array</a> object
or an <a>Object</a> object:
<dd><p>Return the result of running the <a>clone an object</a> algorithm
with arguments <var>value</var> and <var>seen</var>,
and the <a>JSON deserialize</a> algorithm as the clone algorithm.
and the <a>JSON deserialise</a> algorithm as the clone algorithm.

<dt>Otherwise:</dt>
<dd><p>Return <a>error</a> with <a>error code</a> <a>javascript error</a>.
Expand Down Expand Up @@ -4271,7 +4263,9 @@ <h3>Executing Script</h3>
<dd><p><a>Success</a> with data <var>value</var>.

<dt>instance of <a>element</a>
<dd><p><a>Serialize the element</a> with argument <var>value</var>.
<dd><p><a>Success</a> with
the <a data-lt="JSON serialisation of an element">JSON serialisation</a>
of the <a>web element</a> <var>value</var>.

<dt>a <a><code>WindowProxy</code> object</a>
<dd><p><a>Success</a> with
Expand Down