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

QImg events types #16545

Closed
KonstantinSerebryakov opened this issue Nov 2, 2023 · 7 comments
Closed

QImg events types #16545

KonstantinSerebryakov opened this issue Nov 2, 2023 · 7 comments

Comments

@KonstantinSerebryakov
Copy link

Description

documentation says @error take src parameter:

src: Error
Description
JS Error object

while at runtime it actually pass Event with type 'error' object:

template:

  <q-img
    @error="handleError"
    src="someinvalidsrc.png"
  ></q-img>

script:

function handleError(e) {
    console.log(e instanceof Event);
}

Documentation Section URL

https://quasar.dev/vue-components/img#qimg-api

Flavour

None

Areas

TypeScript Support

@pdanpdan
Copy link
Collaborator

pdanpdan commented Nov 5, 2023

You can make a PR for this - the description is good, only the parameter name is strange

@rstoenescu
Copy link
Member

Fix will be available in Quasar v2.13.1

@yusufkandemir
Copy link
Member

@rstoenescu I think the main point here is the payload being an instance of Event, not Error.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/error_event#event_type

@pdanpdan
Copy link
Collaborator

pdanpdan commented Nov 9, 2023

Unfortunately, checking the code, it looks like it can be Event (from img onerror) and Error (from img.decode)

@rstoenescu
Copy link
Member

@yusufkandemir
The native "error" event emitted by the IMG tag has an Event as param. We are simply passing it over to the user.
Some info - https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/error_event

@yusufkandemir
Copy link
Member

@rstoenescu yes, I am aware of that, that's the point. We are emitting Event but we are using Error as the type, which is incorrect.

@rstoenescu
Copy link
Member

@yusufkandemir thanks for pointing this out.

Final fix will be available on Quasar v2.13.2

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

No branches or pull requests

4 participants