w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
676 stars 190 forks source link

Add "DOMTokenList" to collections #1728

Closed whimboo closed 1 year ago

whimboo commented 1 year ago

Right now the DOMTokenList is not handled as collection and as such falls back to an arbitrary object.

The serialization results in an empty object to be returned because there are no enumerable properties. To actually allow Get Element Property to return the classList it needs to be handled as a collection.


Preview | Diff

whimboo commented 1 year ago

Tests will be added via https://bugzilla.mozilla.org/show_bug.cgi?id=1823464.

whimboo commented 1 year ago

@gsnedders could you have a look as well? Thanks.

whimboo commented 1 year ago

This seems fine. But: we should probably come up with a clearer policy as to what we actually want to include here—there's plenty more interfaces we could reasonable include here, after all.

I agree but someone would have to collect these. Maybe we can put a focus for that for Webdriver BiDi first where https://github.com/w3c/webdriver-bidi/issues/318 is already filed. Then we could backport to classic if needed.

whimboo commented 1 year ago

@jgraham and @sadym-chromium can you please review? Thanks.

sadym-chromium commented 1 year ago

Do we really want to change WebDriver Classic serialization, as it is in support mode?

sadym-chromium commented 1 year ago

Do we really want to change WebDriver Classic serialization, as it is in support mode?

Even though the change seems reasonable.

jgraham commented 1 year ago

AIUI the change aligns the spec with Chrome's existing behaviour?

gsnedders commented 1 year ago

Do we really want to change WebDriver Classic serialization, as it is in support mode?

I think categorising WebDriver Classic as "support mode" is disingenuous; if it were truly in some sort of support mode, we wouldn't still be adding new endpoints to it.

Regardless, as we do with the web platform, we should continue to ensure legacy functionality keeps working, even in the face of new features.

sadym-chromium commented 1 year ago

AIUI the change aligns the spec with Chrome's existing behaviour?

Correct, ChromeDriver returns {'value': ['a', 'b', 'c']} as a result of (()=>{var div = document.createElement('div');div.className='a b c'; return div.classList})()