Skip to content

Commit

Permalink
Reduced version, based on CSS parsing only
Browse files Browse the repository at this point in the history
  • Loading branch information
mibalan committed Mar 30, 2012
1 parent 0eecb94 commit c2b0c87
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions feature-detects/css-regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,4 @@
// Simple, CSS parser based
Modernizr.addTest('regions',
Modernizr.testAllProps('flowInto')
);

// More complete, behavior based version
Modernizr.addTest('regions', function() {
if (Modernizr.testAllProps('flowInto')) {
var style = 'position: fixed; width: 20px; height: 20px; visibility: hidden;';
var contentStyle = 'top: -50px; left: -50px;';
var regionStyle = 'top: -100px; left: 0px;';

var contentDiv = document.createElement('div');
contentDiv.style.cssText = style + contentStyle;
contentDiv.style[Modernizr.prefixed('flowInto')] = 'f1';

var regionDiv = document.createElement('div');
regionDiv.style.cssText = style + regionStyle;
regionDiv.style[Modernizr.prefixed('flowFrom')] = 'f1';

var contentRect = contentDiv.getBoundingClientRect();

delete contentDiv;
delete regionDiv;

if (contentRect.left < 0) {
return false;
} else {
return true;
}
} else {
return false;
}
});
);

0 comments on commit c2b0c87

Please sign in to comment.