-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Simplify HTMLAllCollection as allowed by usage data #1379
Comments
From what I can tell all of those usage counters are basically zero, not just those two. If we're planning usage-data related simplification, we could drop a lot of behavior. |
I've made a ton of changes ;-) Here is our current WebIDL. Note, we've found at least once consumer of every single behavior within our corpus. So I would consider the below the interoperable behavior. Some of the consumers were internal. /// @specs HTML5
/// @tags TreeNavigation
interface HTMLAllCollection
{
readonly attribute unsigned long length;
getter Element? (unsigned long index);
getter (HTMLCollection or Element)? namedItem(DOMString name);
legacycaller (HTMLCollection or Element)? item(optional DOMString nameOrIndex);
}; |
We could probably remove the |
It's noteworthy that @DigiTec's IDL matches the current spec exactly :). I guess removing the |
So what I'm hearing is that observed usage for the edge cases @DigiTec's IDL aims to support is basically 0, yes? |
As far as I can tell based on the usage data we could get rid of the |
I think the data looks inconsistent because the stable channel rollout hasn't finished yet, numbers are still increasing. Internally, again, DocumentAllLegacyCall ≈ DocumentAllLegacyCallNamed + DocumentAllLegacyCallIndexed, which makes sense. DocumentAllLegacyCallTwoArguments actually has 3× the usage of any of the *NoArguments and *IndexedWithNonNumber counters, and I think we should try removing that from Blink, so my preference is to align with Gecko on these other details, but reaching interop is the top priority. The biggest risk here is with making the argument non-optional, but the usage of So, @DigiTec, do you have any appetite for trying this, or do you want to see literally zero usage of the code paths to consider it? |
Per the IDL, we already removed the two argument overloads. We no longer support those. And I can remove the "optional" flavor of all() and all.item(). We have test and app data for every other variation that claims enough usage that we wouldn't want to remove. We didn't implement use counters though, so our data is only from regression analysis. |
That's good, the no-argument form does nothing useful and cannot be intentional. By regression analysis, do you mean that you've found pages that would break if the string-as-index handling were removed, or that string arguments with only digits show up in static searches of source code? |
Let me use code to be clear. We have confirmed hits of real apps/sites using: document.all(number);
document.all(string);
document.all.string;
document.all.item(number);
document.all.item(string); So we've seen breakage and its painful to track it down. A mistake I made in unifying our collections implementations back in March is still resulting in slightly broken web behaviors as we keep finding new obscure use cases. If we are committed to removing the |
I've written test for the currently spec'd behavior in web-platform-tests/wpt#4037 The tests "legacy caller with no argument" and "item method with no argument" are relevant for whether we make that argument required. Current behavior:
When the current tests have been reviewed and merged, I will propose a change to make those arguments required. |
I tried to make Blink match what I'd want the spec to say, but ran into exactly what @bzbarsky said in #775 (comment). The array index handling is in the bindings layer, so either you'd need custom bindings or duplication of it. Given the usage and the fact that it doesn't work in Firefox, I'd be pretty hopeful about making that change in Blink. |
What's the status on this? |
I'd prefer we close this and stop tweaking legacy objects further unless there's a really compelling benefit in doing so. |
I think it might still be worthwhile getting rid of the @bzbarsky, how much effort would you like me to put in to avoid Gecko having to implement the current spec? |
That's a hard question to answer free-response. Can we make it multiple choice? What are the options? @annevk There may be a compelling benefit here, if we can minimize changes to existing UAs and have a simpler behavior. If we can't then we can't of course. |
Sure, let's see. This is what I was hoping some months ago to change Blink's IDL into: /* [LegacyUnenumerableNamedProperties] not in Blink, ignoring for this discussion */
interface HTMLAllCollection {
readonly attribute unsigned long length;
getter Element? (unsigned long index);
getter (NodeList or Element)? namedItem(DOMString name);
legacycaller (NodeList or Element)? item((DOMString or unsigned long) nameOrIndex);
}; In other words, different from the current spec in these ways:
So, it's really the last two points here. I could do both, either, or none of them, those are the options. |
Well, more time has passed, and per https://wpt.fyi/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html Safari now passes all but one test. It looks like this happened in https://trac.webkit.org/changeset/216851/webkit, i.e. after we made the last changes here. Given that, I don't want to change the spec again, causing WebKit to have to change again. Since I filed this I'll also close it, but if anyone feels otherwise please ask for it to be reopened, or file a new issue for specific changes. |
See also #2932, where an updated version of this discussion took place. |
As mentioned in #775 (comment) and #780 (comment) I added use counters to Blink, and those have now reached the stable channel:
A few older ones for comparison:
I said:
The counters in question are the *NoArguments and *IndexedWithNonNumber ones. Of these none have risen to 0.0001%, and in fact looking at internal data the highest of them is just 0.00000035%.
Based on this, I would suggest making the argument non-optional and dropping the string-as-index handling, which I think matches Gecko.
First things first, has anyone made any changes here yet? Would everyone be OK converging on the current spec plus the suggested changes, or do you prefer to stick to the current spec?
@DigiTec @nox @travisleithead @bzbarsky @smaug----
The text was updated successfully, but these errors were encountered: