Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make <img> src attribute optional if srcset is present #9181

Closed
@foolip

Description

@foolip

https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element currently requires:

Thesrc attribute must be present, and must contain avalid non-empty URL potentially surrounded by spaces referencing a non-interactive, optionally animated, image resource that is neither paged nor scripted.

and

Thesrcset attribute may also be present, and is asrcset attribute.

In other words, a validator should complain about animg element with asrcset attribute but nosrc, andhttps://validator.nu/ does.

However, it's not clear why it's important to require putting one source in thesrc attribute, instead of putting them all insrcset. The processing model deals withsrc being missing:

In other words, omittingsrc works just fine in practice.

Whensrcset was new it made sense to require asrc, but nowsrcset has been supported everywhere for many years:
https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset#browser_compatibility

Is it time to makesrc optional and not require sending unused markup like this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp