| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM with a few small things.
At some point (maybe now?) we'll also want a [WebDX UseCounter](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom;bpv=1;bpt=0) that measures the use of HTMLSubmitButtonBehavior all-up and will be associated with its entry in https://github.com/web-platform-dx/web-features. The HTMLSubmitButtonBehavior constructor would be a good place for it.
UseCounter::Count(Target().GetDocument(),This can be done in the `element_internals.idl` with the [`MeasureAs`](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#measureas) extended attribute.
UseCounter::Count(execution_context,Can be done with `MeasureAs` extended attribute on the `html_submit_button_behavior.idl` constructor.
assert_true(internals.isUseCounted(document, kHTMLSubmitButtonBehaviorUsage));nit: you could make this more fine-grained by assigning `new HTMLSubmitButtonBehavior()` to a variable, then checking that `kHTMLSubmitButtonBehaviorUsage` (and only `kHTMLSubmitButtonBehaviorUsage`) is set, and only then doing `attachInternals` and checking the other counter.
assert_false(internals.isUseCounted(document, kElementInternalsBehaviorsAccess));Another good test case would be to validate that this is still counted even when `behaviors` is empty.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
This can be done in the `element_internals.idl` with the [`MeasureAs`](https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#measureas) extended attribute.
Done
Can be done with `MeasureAs` extended attribute on the `html_submit_button_behavior.idl` constructor.
Done
assert_true(internals.isUseCounted(document, kHTMLSubmitButtonBehaviorUsage));nit: you could make this more fine-grained by assigning `new HTMLSubmitButtonBehavior()` to a variable, then checking that `kHTMLSubmitButtonBehaviorUsage` (and only `kHTMLSubmitButtonBehaviorUsage`) is set, and only then doing `attachInternals` and checking the other counter.
Done
assert_false(internals.isUseCounted(document, kElementInternalsBehaviorsAccess));Another good test case would be to validate that this is still counted even when `behaviors` is empty.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
LGTM with a few small things.
At some point (maybe now?) we'll also want a [WebDX UseCounter](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/use_counter/metrics/webdx_feature.mojom;bpv=1;bpt=0) that measures the use of HTMLSubmitButtonBehavior all-up and will be associated with its entry in https://github.com/web-platform-dx/web-features. The HTMLSubmitButtonBehavior constructor would be a good place for it.
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM, just one comment about the tests.
assert_false(internals.isUseCounted(document, UseCounter.kElementInternalsWithBehaviors));In all of these tests, it'd be good to assert the state of all three counters, just to make your expectations explicit.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks for the reviews!
assert_false(internals.isUseCounted(document, UseCounter.kElementInternalsWithBehaviors));In all of these tests, it'd be good to assert the state of all three counters, just to make your expectations explicit.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
4 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: tools/metrics/histograms/metadata/blink/enums.xml
Insertions: 8, Deletions: 3.
The diff is too large to show. Please review the diff.
```
```
The name of the file: third_party/blink/web_tests/fast/forms/element-internals-behaviors-usecounter.html
Insertions: 16, Deletions: 4.
The diff is too large to show. Please review the diff.
```
```
The name of the file: third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom
Insertions: 8, Deletions: 3.
The diff is too large to show. Please review the diff.
```
[Platform-provided behaviors] Use counters and console warning
This change adds three new UseCounters to track feature adoption and
usage patterns:
- kElementInternalsWithBehaviors: Counted when attachInternals() is
called with a behaviors list.
- kElementInternalsBehaviorsAccess: Counted when the behaviors getter
on ElementInternals is accessed.
- kHTMLSubmitButtonBehaviorUsage: Counted when the submit button
behavior is instantiated.
A console warning is now issued when an HTMLSubmitButtonBehavior is
attached to a custom element that is not form-associated to provide
feedback to developers when the behavior is used in a context where it
can't submit forms.
Explainer:
https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/PlatformProvidedBehaviors/explainer.md
Design doc:
https://docs.google.com/document/d/1LA1hhzxmi4OmZoGtIdnwvL3g7y48YjXTOoUvFtxFugE/edit?usp=sharing
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |