#microformats 2022-09-23
2022-09-23 UTC
ur5us, jacky and [jgarber] joined the channel
# [jgarber] Has anyone else taken a swing at https://github.com/microformats/microformats2-parsing/issues/7 ? I’ve got `img[srcset]` parsing working in a yet-to-be-released version of MicroMicro implementing what I laid out back in 2020 in this comment: https://github.com/microformats/microformats2-parsing/issues/7#issuecomment-619023503
# [tantek]4 [jgarber] looks like there are sufficient use-cases to try solving this problem. I do like the Bridgy Publish use-case myself as I have definitely struggled with marking up my photo posts so that one resolution is shown on my website, and another much higher resolution (linked) is what is sent to Bridgy to POSSE to other sites
# [tantek]4 currently I have that "working" without srcset, however I have a feeling that I may hit a limit with some photos where I want the max resolution to go to Flickr, but then have a downlevel but still high resolution to go to Twitter, and then a medium resolution for display on the page itself
# [tantek]4 looks like we didn't settle on *how* srcset should be parsed, just kept as a string, subparsed into a nested structure, if so indexed array or keys
# [tantek]4 I'm curious which approach would be easier for Bridgy to parse and look for what it wants
# [tantek]4 none of the examples provided the bytes size of the image, only dimensions, so is the assumption that bridgy would try the largest (dimensional) image and see if that fits for POSSEing, and if not, go to the next smaller one, try that, and on down the line?
# [tantek]4 also did anyone look into how the img element DOM was modified for srcset? is it "just" an attribute that returns a string value, or is there a srcset DOM with the individual pieces and ways to manipulate it?
# [jgarber] That’s a long-winded way of saying “What I wrote here way back when”: https://github.com/microformats/microformats2-parsing/issues/7#issuecomment-619023503
# Loqi [jgarber623] Building on @dshanske's comment with some uses cases pulled from [MDN's Responsive Images tutorial](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images). URLs are resolved based on a hypothetical source page...
# [jgarber] Apologies, “width descriptor” above is more correctly “condition descriptor” which could be _either_ a width descriptor (e.g. `480w`) or a pixel density descriptor (e.g. `2x`). Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset
# [tantek]4 I think all the use-cases are zero UI
# [tantek]4 looks like the DOM treats srcset as one string
# [tantek]4 it would be consistent to provide a string in the mf2 parsed json. it would also preserve the orders of the condition/URL pairs
# [tantek]4 the use of a JSON structure with keys does not guarantee order of the keys
# [tantek]4 which would then not work for the HTML->mf2JSON->HTML use-case mentioned
# [tantek]4 I wonder if there are tests for it
# [tantek]4 likely in WPT
# [tantek]4 https://web-platform-tests.org/
# [tantek]4 hmm, I suppose we have to parse out the URLs inside a srcset value in order to resolve relative URLs
Seirdy and ur5us joined the channel
gRegorLove_ and petermolnar joined the channel
# [KevinMarks] If you want to preserve order you can parse to a list rather than a dict, but knowing if order matters is useful, and resolving relative urls is consistent with the rest of URL handling.
ur5us, gRegorLove_ and jacky joined the channel
# [KevinMarks] So that does imply that order matters for duplicates , so if you are making it a dict you want to not override an existing key.
jacky, gRegorLove__ and gRegor joined the channel
# [tantek]4 good catch [KevinMarks], about not overriding
jacky and gRegorLove_ joined the channel; petermolnar left the channel
# [tantek]4 jgarber can you show an example that demonstrates multiple valid condition descriptors, perhaps even mixing the 2x vs 800w style, and the 480w dupe?
# [tantek]4 hoping to get a complex enough bit of JSON output for [snarfed] to evaluate as to how Bridgy might try parsing it prioritizing the keys for figuring out which image resolution to post where when POSSEing
# [snarfed]1 :thumbsup:
jacky, gRegorLove__ and jeremycherfas joined the channel
ur5us joined the channel
# [tantek]4 That looks good to me. [snarfed]?