What is the issue with the HTML Standard?
While trying to spec the checkable attribute on <fieldset> I was reading the prose for how reflection of enumerated attributes works, and it doesn't seem to me to be fully defined what should happen.
The definitions in https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes%3Aidl-domstring-3 define how a getter should reflect a DOM attribute when it is reflected as DOMString or (in the following definition) as DOMString?. A few things here seem problematic to me:
- for the first part (
DOMString), it uses the somewhat vague wording of "correspond to" when I think it would probably make sense to determine the corresponding state using the formal (but not linkable!) definition of "to determine the state of an attribute" in https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute . As far as I can tell it doesn't do anything that actually invokes that definition. But I'm not sure what "correspond to" is supposed to mean other than referring to that definition.
- for the second part (
DOMString?) I think the problem is more serious: getter step 4.2 simply says "Assert: contentAttributeValue corresponds to a state of attributeDefinition." and I don't see anything that ensures this is the case. As far as I can tell, contentAttributeValue is at that point the raw value of the attribute. I think it would make sense to again defer to the "to determine the state of an attribute" definition, and then return null when "no state" is returned from that algorithm.
That said, I'm not entirely sure if that is either (a) what is intended or (b) what is implemented.
Also, since it took me a minute to find, an existing example of the DOMString? reflection is HTMLLinkElement.crossOrigin. (And, back to my original motivation, I think it makes sense for <fieldset checkable> to reflect in a similar way.)
(This is related to the much larger work in #3238 and #11455 but I don't think either really interferes with the other. cc @lukewarlow nonetheless.)
(I'd be happy to make a PR if folks think the above makes sense.)
What is the issue with the HTML Standard?
While trying to spec the
checkableattribute on<fieldset>I was reading the prose for how reflection of enumerated attributes works, and it doesn't seem to me to be fully defined what should happen.The definitions in https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes%3Aidl-domstring-3 define how a getter should reflect a DOM attribute when it is reflected as
DOMStringor (in the following definition) asDOMString?. A few things here seem problematic to me:DOMString), it uses the somewhat vague wording of "correspond to" when I think it would probably make sense to determine the corresponding state using the formal (but not linkable!) definition of "to determine the state of an attribute" in https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#enumerated-attribute . As far as I can tell it doesn't do anything that actually invokes that definition. But I'm not sure what "correspond to" is supposed to mean other than referring to that definition.DOMString?) I think the problem is more serious: getter step 4.2 simply says "Assert: contentAttributeValue corresponds to a state of attributeDefinition." and I don't see anything that ensures this is the case. As far as I can tell, contentAttributeValue is at that point the raw value of the attribute. I think it would make sense to again defer to the "to determine the state of an attribute" definition, and then return null when "no state" is returned from that algorithm.That said, I'm not entirely sure if that is either (a) what is intended or (b) what is implemented.
Also, since it took me a minute to find, an existing example of the
DOMString?reflection isHTMLLinkElement.crossOrigin. (And, back to my original motivation, I think it makes sense for<fieldset checkable>to reflect in a similar way.)(This is related to the much larger work in #3238 and #11455 but I don't think either really interferes with the other. cc @lukewarlow nonetheless.)
(I'd be happy to make a PR if folks think the above makes sense.)