wp-shortcake / shortcake-bakery

A fine selection of shortcodes for WordPress
42 stars 16 forks source link

Use `width` and `height` attributes when data attributes aren't present #138

Closed danielbachhuber closed 8 years ago

danielbachhuber commented 8 years ago

Fixes #133

danielbachhuber commented 8 years ago

@goldenapples #reviewmerge

goldenapples commented 8 years ago

The concept seems good, but I think there might be some edge cases where dimensions are saved as non-pixel values, or where only one of the dimensions is set as an attribute so we're mixing different units.

I suppose the alternative to this pull request is that we should be adding data-true-width and data-true-height to all elements that include shortcake-bakery-responsive class.

Yeah, I suspect this issue was the original reason behind using those data attributes. We could stand to add much more documentation for this. Might be nice to also add a .load handler to all .shortcake-bakery-responsive elements which sets those data attributes based on the element's true dimensions, if they're not already set in the markup.

danielbachhuber commented 8 years ago

Continued in #139