html icon indicating copy to clipboard operation
html copied to clipboard

headers/ping attributes should be string, not tokenlist

Open ayg opened this issue 10 years ago • 17 comments

<!DOCTYPE html>
<script>
document.documentElement.textContent = typeof document.createElement("th").headers;
</script>

Outputs "string" in IE 11 and recent Chrome/Firefox. Spec says it should be "object". Is there any compelling reason that implementations should change, or should the spec change?

@bzbarsky @annevk

ayg avatar Apr 11 '16 14:04 ayg

Also a.ping/area.ping in Chrome/Firefox (IE 11 seemingly doesn't implement it).

ayg avatar Apr 11 '16 14:04 ayg

In general the spec tries to move us toward token lists for attributes that are logically token lists. Combined with PutForwards and toString() defined on token lists, this is hoped to be "backward compatible enough".

Maybe we should give up though, if there are no implementations. It does seem doubtful anyone will want to make these changes, given that it has non-negligible back-compat risk with very little upside.

domenic avatar Apr 11 '16 14:04 domenic

Changing Gecko would be trivial, and I'm happy to do it. The question is if we want to.

ayg avatar Apr 11 '16 15:04 ayg

Does anyone actually use this attribute for anything? Apart from the reflection bits, I don't see any UA conformance requirements for the headers attribute on table cells/headers. Am I just missing them?

If there are no UA conformance requirements, why would anyone even set this attribute?

bzbarsky avatar Apr 11 '16 15:04 bzbarsky

Oh, and note that I don't object to trying to make this a tokenlist; I'm just trying to determine the likely compat risks and likely benefits. Currently, my best guess is that the latter is zero and the former is pretty much zero...

bzbarsky avatar Apr 11 '16 15:04 bzbarsky

headers is for a11y/semantics, at least in theory: https://html.spec.whatwg.org/multipage/#table-descriptions-techniques

I agree that the intersection of people who are using it for these purposes and people who really wish they could use the DOMTokenList interface to do so is probably zero, or in the single digits.

ping seems more likely to be useful and, modulo the compat risks, I think it'd be nice if that were implemented as a DOMTokenList.

domenic avatar Apr 11 '16 15:04 domenic

Implementation burden for changing headers is close to zero, so if compat risk is also close to zero, I'm in favor of changing it for the sake of being nicer/more consistent/etc.

ayg avatar Apr 11 '16 15:04 ayg

So, I think we can close this, with the conclusion that we still hope that implementers are willing to move these to DOMTokenLists. Do you guys agree?

domenic avatar Apr 20 '16 21:04 domenic

This is tested in http://w3c-test.org/html/dom/interfaces.html

https://bugs.chromium.org/p/chromium/issues/detail?id=606724 https://bugs.webkit.org/show_bug.cgi?id=157031 https://bugzilla.mozilla.org/show_bug.cgi?id=1263000 https://bugzilla.mozilla.org/show_bug.cgi?id=1244751 https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7339862/

Please comment or reopen if new information comes up (e.g. if it breaks pages).

zcorpan avatar Apr 26 '16 10:04 zcorpan

Also HTMLElement.dropzone but firstly must be implement as content attr: https://bugzilla.mozilla.org/show_bug.cgi?id=723008 I add small test for all: https://github.com/w3c/web-platform-tests/pull/2932

ArkadiuszMichalski avatar May 01 '16 07:05 ArkadiuszMichalski

New info from the Chromium issue:

It has been already done and reverted once ( https://codereview.chromium.org/1416043002). It seems to be breaking some functionality in google.co.in. So is it worth to do this change again now?

So ping is known to cause some breakage.

zcorpan avatar May 13 '16 18:05 zcorpan

OK, so with that new info I feel like we should probably change ping to a string, as sad as it is. Does anyone disagree?

Can we get two implementers interested in adding pingList, or should we just give up on a structured DOM API for multiple ping URLs?

domenic avatar May 13 '16 23:05 domenic

I think we should only do it once someone has a real need. Perhaps once we expose a constructor for DOMStringList it might not even be necessary.

annevk avatar May 16 '16 07:05 annevk

What about headers? Switch that back also? (It seems to me use of headers is pretty much always going to be static in markup, and it's a very rarely-needed feature anyway.)

zcorpan avatar May 16 '16 09:05 zcorpan

Hi, jumping in the middle (always a bad idea, but...) Headers, I get. Very handy.https://www.w3.org/TR/html-markup/header.html Ping, other than the timeless network testing tool, I'm completely missing; also, not the above www.ws3.org site

scshepard avatar May 16 '16 09:05 scshepard

The <header> element is not under discussion here. This is about <td headers=""> attribute's corresponding .headers IDL attribute.

The document you linked to says at the top

This document has been discontinued and is only made available for historical purposes.

cheers

zcorpan avatar May 16 '16 09:05 zcorpan

I've posted https://github.com/whatwg/html/pull/1262 to move them to USVString/DOMString instead, and give up on the idea that all token-list attributes should be reflected as DOMTokenLists. Ah well!

domenic avatar May 16 '16 23:05 domenic