Skip to content

Commit

Permalink
Build for editorconfig checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
jefflembeck committed May 28, 2014
1 parent 4be7267 commit df8cbd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dist/picturefill.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,21 @@ window.matchMedia || (window.matchMedia = function() {
pf.getWidthFromLength = function( length ) {
// If no length was specified, or it is 0, default to `100vw` (per the spec).
length = length && parseFloat( length ) > 0 ? length : "100vw";

/**
* If length is specified in `vw` units, use `%` instead since the div we’re measuring
* is injected at the top of the document.
*
* TODO: maybe we should put this behind a feature test for `vw`?
*/
length = length.replace( "vw", "%" );

// Create a cached element for getting length value widths
if ( !pf.lengthEl ) {
pf.lengthEl = doc.createElement( "div" );
doc.documentElement.insertBefore( pf.lengthEl, doc.documentElement.firstChild );
}

// Positioning styles help prevent padding/margin/width on `html` from throwing calculations off.
pf.lengthEl.style.cssText = "position: absolute; left: 0; width: " + length + ";";
// Using offsetWidth to get width from CSS
Expand Down

0 comments on commit df8cbd1

Please sign in to comment.