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

img element cannot properly handle "loading" attribute #655

Closed
VividLemon opened this issue Nov 16, 2022 · 0 comments
Closed

img element cannot properly handle "loading" attribute #655

VividLemon opened this issue Nov 16, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@VividLemon
Copy link

VividLemon commented Nov 16, 2022

Describe the bug
A clear and concise description of what the bug is.
I'm using Vue, so terms may get confused. Essentially, happy-dom doesn't set loading attribute on img to be eager or loading
To Reproduce
Steps to reproduce the behavior:

  1. Set attribute loading on to be "lazy"
  2. attribute loading does not become lazy

Expected behavior
A clear and concise description of what you expected to happen.
Attribute loading should become lazy
Screenshots
If applicable, add screenshots to help explain your problem.
Ask if wanted
Device:

  • OS: [e.g. iOS] Linux mint
  • Browser [e.g. chrome, safari] Chrome,
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

My Vue test

  it('has attr loading to be lazy when prop lazy', () => {
    const wrapper = mount(BImg, {
      props: {lazy: true},
    })
    expect(wrapper.attributes('loading')).toBe('lazy')
  })

  it('has attr loading to be eager when prop lazy false', () => {
    const wrapper = mount(BImg, {
      props: {lazy: false},
    })
    expect(wrapper.attributes('loading')).toBe('eager')
  })

  it('has attr loading to be eager by default', () => {
    const wrapper = mount(BImg)
    expect(wrapper.attributes('loading')).toBe('eager') // In my code prop loading is undefined === prop loading is false
  })

When using happy-dom, all of these "loading" attributes become undefined. Lazy on becomes loading="lazy", lazy off becomes loading="eager". Neither are made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant