Planning for <picture> markup #125
Comments
Also, @jansepar has done a great job getting this started here, and it sounds like he's up for helping with this refactor https://github.com/jansepar/picturefill |
I was just doing some refactoring of picturefill on a Drupal install based on the suggestions in this patch. The default Picturefill can get pretty slow if there are a number of images picturefilled in IE9. By reducing the number of get attribute calls and switching to the match-media script in weblinc's polyfill for Picture, I was able to get things running significantly faster. This was the span-based picturefill, but I could try to contribute some of those changes back here if you think it would be worthwhile. |
Quick update: |
Yup definitely up for helping. I'll see what I can do over the weekend ;). +1 to tests and bower - I've got tests up and running on my fork. |
I have a rough implementation of |
Awesome, @nwtn . Sounds like another feature that'd be nice to build as a module to tie-in? |
+1. Really dig the idea of having features broken out into modules, too. Thinking we could have the Picturefill core and stand-alone extensions for things like |
+1 for modularity. @nwtn Also cool to see some work being done to polyfill the type attribute. :) |
@scottjehl +1 ya modular would be great. Question: does using the real syntax in picturefill mean |
Good question. No, I do think it's probably best to stick with noscript around the img element for a good while. On Feb 28, 2014, at 12:26 PM, David Newton notifications@github.com wrote:
|
Since the new picture is leveraging the actual |
I think that's okay, so long as the Polyfill script is written in such a way that it handles a very broad group of browsers, including those that do not even support media queries at all. On this note though, I do think that sticking with older JavaScript methods throughout our codebase will go a long way. For example, using On Feb 28, 2014, at 12:46 PM, David Newton notifications@github.com wrote:
|
Awesome! Any plans to implement RespImg or is that out of scope? |
@jonathantneal that one is out of date. From that page: "This specification is obsolete and has been replaced by the document at http://picture.responsiveimages.org/. Do not attempt to implement this specification. Do not refer to this specification except as a historical artifact." |
@jansepar, thanks for pointing that out to me. The parts I liked from RespImg made their way into <picture> so I’m a happy camper, and also a little more with the times. |
@scottjehl would love a review on my PR if you have time sometime soon! Should get us significantly closer to a solution that more closely resembles the picture element spec. |
Looking great, @jansepar . I'd love if we could start breaking things into independent modules so that features can be built independently – Also, as long as it tests well, I'm cool with the I'm still not sure we should support the |
+1 to this being awesome—great work, man. I think I still lean towards giving IE the fallback over the |
@scottjehl @Wilto thanks! I'll look into making it more modular, as well as write some tests to see if there are any performance implications of using the I was also thinking that rather then starting the image downloads at DOMContentLoaded, we could instead load the script async in the |
+9999 to that |
Awesome. I already have the codes for that - I'll bring it into this PR :) |
@yoavweiss Alright, added async support! The default mode is to poll the document until its ready, meaning you can include the script async: https://github.com/jansepar/picturefill/blob/master/index.html#L12. Here is the code to support that: https://github.com/jansepar/picturefill/blob/master/picturefill.js#L266 |
Awesome work, thanks! I wonder, how did you get to the 250ms number? Do you Le dimanche 16 mars 2014, Shawn Jansepar notifications@github.com a
|
Going over the code, I see that you're going over all the picture elements Le dimanche 16 mars 2014, Yoav Weiss yoav@yoav.ws a écrit :
|
@yoavweiss the 250 number was a total guess :). As for going over all the picture elements - I did that to keep the change minimal for now. Keeping track of the elements already covered means adding more complexity because we'd need multiple modes (when resizing, we wouldn't want to prevent us from changing those images). I completely agree that this change should be made, just won't have time to do it today. Once I make that change it also means I'd be more comfortable decreasing the polling interval length! |
Sounds like a plan :) Le dimanche 16 mars 2014, Shawn Jansepar notifications@github.com a
|
Just adding a note here that our recommended markup may be affected by however this conversation pans out: ResponsiveImagesCG/picture-element#131 (comment) |
Closing this out now that it's replaced by itemized tickets for v2 Milestone here: https://github.com/scottjehl/picturefill/issues?milestone=1&state=open |
Now that
srcset
has landed in browsers andpicture
is coming soon, it'd be a good time to get Picturefill back to its original goal as a simple polyfill for the standard markup.This thread can be used for planning that out, as there are a number of things to consider. Here are a few off the top of my head:
source
elements if they don't have avideo
oraudio
element parent. We'll need to find a way to work around this one - ideally without changing the markup pattern to accommodate, but that may not be possible. Here's how I worked around it in the past (note: gross) https://github.com/scottjehl/picturefill/tree/original-picture-markupsource[srcset]
handling was written as an excludable extension to Picturefill, so people can include it in the build if needed.Also, we should get this thing running on grunt, updated on Bower, and unit tested.
Woo!
The text was updated successfully, but these errors were encountered: