-
Notifications
You must be signed in to change notification settings - Fork 56
Add HTMLHyperlinkElementUtils. #144
Add HTMLHyperlinkElementUtils. #144
Conversation
@@ -0,0 +1,41 @@ | |||
-- https://html.spec.whatwg.org/multipage/links.html#htmlhyperlinkelementutils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we extend this comment a bit futher - the specs used in this library are generally from the w3c not the whatwg... however, in this case, after doing some research it turns out this might be the only place the IDL is actually stated for this API.
It's called URLUtils
in the HTML5 spec, which points to a URL standard document, which now points to a whatwg document, which doesn't have the interface listed. As far as I can tell from the non-IDL descriptions in the w3c spec though, this HTMLHyperlinkElementUtils
IDL has all the same elements as the now-missing URLUtils
API.
So I'd suggest something like:
The `URLUtils` interface referenced in https://www.w3.org/TR/html50/infrastructure.html#urlutils, now documented at https://html.spec.whatwg.org/multipage/links.html#htmlhyperlinkelementutils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder which name we should use for this module and type, between "URLUtils" and "HTMLHyperlinkElementUtils". I feel like the latter term actually has a specification, which is good enough reason to choose this name rather than "URLUtils", and also it better fits the names of other types in this lib, like "HTMLAnchorElement".
Yeah, I was curious the relationship between w3 and whatwg's specs.
BTW, I chose the whatwg spec because that's the one MDN references:
Specifications
HTML Living Standard
The definition of 'HTMLHyperlinkElementUtils.href' in that specification.
Source: https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/href
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand it, the whatwg/living standard stuff is basically "encode what is commonly available in a spec" 😄 (rather than the w3c specs that describe how things are intended to work, before an implementation exists). I said in the readme we were going off the w3c specs, but maybe the living standard(s) would be more practical.
Really I was just hoping to avoid implementing browser quirks in the API / experimental stuff that is not widely implemented and agreed upon yet. LS would probably also satisfy that.
Bump - this one is reviewable again, possibly good to merge. |
Sorry, thanks! |
#143
This API is required to get the
href
attribute from an anchor element. I just threw this together to get a concrete proposal for this. I think it's working in my experiment project.