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

No style field on Element #176

Closed
mnordine opened this issue Feb 16, 2024 · 8 comments
Closed

No style field on Element #176

mnordine opened this issue Feb 16, 2024 · 8 comments

Comments

@mnordine
Copy link
Contributor

mnordine commented Feb 16, 2024

import 'package:web/web.dart';

void main() {
  document.querySelector('a')?.style.visiblity = 'visible';
}
The getter `style` is not defined for the type `Element`.
@devoncarew
Copy link
Member

It looks like querySelector() returns an Element; you'll want to cast that to an HTMLElement (and, visiblity => visibility).

@mnordine
Copy link
Contributor Author

mnordine commented Feb 16, 2024

Should I have to? Should it returnHTMLElement? Why does web have Element at all?

@kevmoo
Copy link
Member

kevmoo commented Feb 16, 2024

Should I have to? Should it returnHTMLElement? Why does web have Element at all?

We're following the IDL here, which is "law". Avoiding guess work here is good.

@kevmoo kevmoo closed this as completed Feb 16, 2024
@mnordine
Copy link
Contributor Author

Why does web have Element at all?

I still don't understand why you have Element and use it in places, when there is HTMLElement from the IDL? That's my point.

@kevmoo
Copy link
Member

kevmoo commented Feb 17, 2024

@mnordine – can you link to the IDL? I don't think we're messing this up (it's all very automated).

@mnordine
Copy link
Contributor Author

mnordine commented Feb 17, 2024

I don't know where exactly, it just seems like you now have HTMLElement, but you're still somehow using Element in places, such as the above?

@kevmoo
Copy link
Member

kevmoo commented Feb 17, 2024

@mnordine
Copy link
Contributor Author

OK, thanks. I was confused because I didn't realize there actually was HTMLElement and Element in the IDL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants