Request: preserve classes applied to <source>/[data-src] elements #12

Closed
beep opened this Issue Apr 27, 2012 · 5 comments

2 participants

@beep
Collaborator

It’d be great if I could set a class attribute on a source/[data-src] element, and it’d be preserved in the rendered img.

Absent a draft spec, this behavior seems intuitive to me.

@scottjehl
Owner

The latest version in master appends the img to the selected source child element, so you can easily target the image through a parent selector if you add classes to your data-src elements. I'm closing this out assuming that'll address the issue, but let me know if there's a case it doesn't cover! Thanks @beep. :)

@scottjehl scottjehl closed this Jun 6, 2013
@beep
Collaborator

YOUR VERY REASONABLE APPROACH IS DISCONCERTING TO Moh i can’t even fake outrage. This is awesome!

@beep
Collaborator

The one thing that occurs would be legacy browser support, since [data-media] selectors would be iffy on older IEs. Not sure if that’s a concern or not, but I thought I’d mention it.

@scottjehl
Owner

good point, @beep. For docs example sake, maybe a class on the [data-picture] element would be better then?

<span data-picture class="picture" ...>
    <span class="sml" data-src=...>
.picture .sml img { ... }  
@beep
Collaborator

For docs example sake, maybe a class on the [data-picture] element would be better then?

Yeah, definitely an option! The original use case was really about applying different layout rules depending on which image got applied. (Which attribute selectors definitely solve, for the right browsers.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment