metafizzy / flickity

:leaves: Touch, responsive, flickable carousels
https://flickity.metafizzy.co
7.53k stars 605 forks source link

add validation for image source #1266

Open qmjose opened 1 year ago

qmjose commented 1 year ago

Check for src attribute being defined before setting it. This will help with <source> tags within <picture> tags to avoid the unnecessary src="null" on <source> tag that is required if the source element's parent is an <audio> and <video> element, but not allowed if the source element's parent is a <picture>element.

<picture>
  <source type="..." data-flickity-lazyload-srcset="...">
  ...
<picture>
<picture>
  <source type="..." srcset="..."  src="null">
<picture>

Based on MDN Documentation