Skip to content
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

Anchor tag does not contain href property #1315

Closed
jesskfullwood opened this issue Mar 5, 2019 · 3 comments · Fixed by #1449 or #1604
Closed

Anchor tag does not contain href property #1315

jesskfullwood opened this issue Mar 5, 2019 · 3 comments · Fixed by #1449 or #1604
Labels
web-sys Issues related to the `web-sys` crate

Comments

@jesskfullwood
Copy link

The href attribute is inherited by the <a> tag via HTMLHyperlinkElementUtils as per
here. However for the life of me I can't find the href getter anywhere in the docs, nor any mention of HTMLHyperlinkElementUtils. href is of course the most useful property of <a>.

@jesskfullwood jesskfullwood added the enhancement New feature or request label Mar 5, 2019
@alexcrichton
Copy link
Contributor

Thanks for the report! Looking into this I believe it's a duplicate of #893, and HTMLHyperlinkElementUtils is indeed on that list.

We may be able to fix this issue specifically though by manually removing the attribute perhaps and/or switching it to a partial interface? The best fix though is to probably just fix the codegen for webidl to not fully ignore these tags!

@alexcrichton alexcrichton added web-sys Issues related to the `web-sys` crate and removed enhancement New feature or request labels Mar 5, 2019
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Apr 12, 2019
This commit enables `[NoInterfaceObject]` annotated interfaces in
`web-sys`. The `NoInterfaceObject` attribute means that there's not
actually a JS class for the object, but all of its properties and such
can still be accessed structually and invoked. This should help provide
more bindings for some more common types on the web!

Note that this builds on recent features to ensure that `dyn_into` and
friends always fail for `NoInterfaceObject` objects because they don't
actually have a class.

Closes rustwasm#893
Closes rustwasm#1257
Closes rustwasm#1315
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Apr 15, 2019
This commit enables `[NoInterfaceObject]` annotated interfaces in
`web-sys`. The `NoInterfaceObject` attribute means that there's not
actually a JS class for the object, but all of its properties and such
can still be accessed structually and invoked. This should help provide
more bindings for some more common types on the web!

Note that this builds on recent features to ensure that `dyn_into` and
friends always fail for `NoInterfaceObject` objects because they don't
actually have a class.

Closes rustwasm#893
Closes rustwasm#1257
Closes rustwasm#1315
@marienz
Copy link
Contributor

marienz commented Jun 17, 2019

Although web-sys now generates bindings for HTMLHyperlinkElementUtils, I still cannot figure out how to actually use them. Calling a.dyn_ref::<HTMLHyperlinkElementUtils>() on an HTMLAnchorElement fails, and the methods from HTMLHyperlinkElementUtils are not present on HTMLAnchorElement.

https://html.spec.whatwg.org/multipage/semantics.html#htmlhyperlinkelementutils (which
HTMLHyperlinkElementUtils.webidl links to as its origin) has interface mixin HTMLHyperlinkElementUtils. mixin is missing from the HTMLHyperlinkElementUtils.webidl in web-sys. I tried adding mixin and that seems to work: it adds a working set_href to HTMLAnchorElement.

Is this a problem with the .webidl file, or am I overlooking a different way of using HTMLHyperlinkElementUtils?

@alexcrichton
Copy link
Contributor

This is probably a case where we can just edit the webidl directly, especially if it's officially included upstream!

@marienz mind sending a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
web-sys Issues related to the `web-sys` crate
Projects
None yet
3 participants