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

Update <a> element monkey patch with content attributes #140

Merged
merged 4 commits into from
May 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 52 additions & 11 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,70 @@ conversion domain.

# HTML monkeypatches # {#html-monkeypatches}

Add the following content attributes to the <{a}> element:
<h3 id="longlong-reflection"> long long reflection </h3>

Add the following rules for <a spec=html>reflecting</a> <a spec=html>content attributes</a>:

If a reflecting IDL attribute has a signed integer type ({{long long}}) then, on getting, the content attribute must be
parsed according to the <a spec="html">rules for parsing integers</a>, and if that is successful, and the value is in the
range of the IDL attribute's type, the resulting value must be returned. If, on the other hand, it fails or returns
an out of range value, or if the attribute is absent, then the default value must be returned instead, or 0 if there
is no default value. On setting, the given value must be converted to the shortest possible string representing the
number as a valid integer and then that string must be used as the new content attribute value.

If a reflecting IDL attribute has a signed integer type ({{long long}}) that is <dfn>limited to only non-negative numbers</dfn> then,
on getting, the content attribute must be parsed according to the <a spec="html">rules for parsing non-negative integers</a>, and if
that is successful, and the value is in the range of the IDL attribute's type, the resulting value must be returned.
If, on the other hand, it fails or returns an out of range value, or if the attribute is absent, the default value
must be returned instead, or −1 if there is no default value. On setting, if the value is negative, the user agent
must throw an {{"IndexSizeError"}} {{DOMException}}. Otherwise, the given value must be converted to the shortest possible
string representing the number as a valid non-negative integer and then that string must be used as the new content
attribute value.

<h3 id="monkeypatch-anchor">&lt;a&gt; element</h3>

Add the following <a spec=html>content attributes</a> to the <{a}> element:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should file a bug against HTML to check if there's a better way to do this than referring to a bunch of non-exported dfns. E.g. HTML could export these definitions.

I believe Anne also likes us to file an HTML issue saying that this monkeypatch exists, like whatwg/fetch#784.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general monkeypatch specs need a lot of similar references to non-exported definitions; that's probably the best way.


: <{a/attributionsourceeventid}>
:: Identifies the declared attribution source
: <{a/attributiondestination}>
:: Site which can attribute an event to the declared attribution source
: <{a/attributionreportto}>
:: [=url/origin=] to receive attribution reports
: <{a/attributionexpiry}>
:: Length of time the attribution souce is valid

Extend the <{a}> element's <a spec=html>DOM interface</a> to include the following interface:

<pre class="idl">
partial interface HTMLAnchorElement {
[CEReactions, Reflect] attribute DOMString attributiondestination;
[CEReactions, Reflect] attribute DOMString attributionsourceeventid;
[CEReactions, Reflect] attribute DOMString attributionreportto;
[CEReactions, Reflect] attribute unsigned long long attributionexpiry;
[CEReactions] attribute DOMString attributionDestination;
[CEReactions] attribute DOMString attributionSourceEventId;
[CEReactions] attribute DOMString attributionReportTo;
[CEReactions] attribute long long attributionExpiry;
};
</pre>

The <dfn for="a" element-attr>attributiondestination</dfn> is an [=url/origin=]
that is intended to be [=same site=] with the origin of the final navigation url resulting
from running <a spec="html">follow the hyperlink</a> with the <{a}> element.
The IDL attributes {{HTMLAnchorElement/attributionDestination}}, {{HTMLAnchorElement/attributionSourceEventId}},
{{HTMLAnchorElement/attributionReportTo}} must <a spec=html>reflect</a> the respective content
attributes of the same name.

The IDL attribute {{HTMLAnchorElement/attributionExpiry}} must reflect the <{a/attributionexpiry}>
content attribute, [=limited to only non-negative numbers=].

The <dfn for="a" element-attr>attributiondestination</dfn> attribute is a string
representing an [=url/origin=] that is intended to be [=same site=] with the origin
of the final navigation url resulting from running <a spec="html">follow the hyperlink</a>
with the <{a}> element.

The <dfn for="a" element-attr>attributionsourceeventid</dfn> is a string
The <dfn for="a" element-attr>attributionsourceeventid</dfn> attribute is a string
containing information about the `attribution source` and will be supplied in the
[=attribution report=].

The <dfn for="a" element-attr>attributionreportto</dfn> optionally declares the
The <dfn for="a" element-attr>attributionreportto</dfn> attribute optionally declares the
[=origin=] to send the [=attribution report=] for this source.

The <dfn for="a" element-attr>attributionexpiry</dfn> optionally defines the amount
The <dfn for="a" element-attr>attributionexpiry</dfn> attribute optionally defines the amount
of time in milliseconds the attribution source should be considered for reporting.

Issue: Need monkey patches passing attribution source in navigation, and a mechanism
Expand Down