Skip to content

Commit

Permalink
make regions property testing cross-browser compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
oslego committed Apr 16, 2012
1 parent 633a5ac commit 9e0abf8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions feature-detects/css-regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ Modernizr.addTest('regions', function() {
content.innerText = 'M';
container.style.cssText = 'top: 150px; left: 150px; padding: 0px;'
region.style.cssText = 'width: 50px; height: 50px; padding: 42px;';
region.style.webkitFlowFrom = flowName;

/* Get the 'flowFrom' property name available in the browser. Either default or vendor prefixed.
If the property name can't be found we'll get Boolean 'false' and fail quickly */
var flowFromProperty = Modernizr.prefixed("flowFrom")
if (!flowFromProperty){
return false
}
region.style[flowFromProperty] = flowName;
container.appendChild(content);
container.appendChild(region);
document.body.appendChild(container);
Expand All @@ -30,7 +37,12 @@ Modernizr.addTest('regions', function() {
should reflect the padding of the region div.*/
var plainRect, flowedRect, delta;
plainRect = content.getBoundingClientRect()
content.style.webkitFlowInto = flowName;

var flowIntoProperty = Modernizr.prefixed("flowInto")
if (!flowIntoProperty){
return false
}
content.style[flowIntoProperty] = flowName;
flowedRect = content.getBoundingClientRect();

delta = flowedRect.left - plainRect.left;
Expand Down

0 comments on commit 9e0abf8

Please sign in to comment.