-ms-expand detection
by John Allan
JavaScript
function testMSExpand () {
var root, node, fake, style, select, bool;
fake = false,
root = document.body || (function () {
fake = true;
return document.documentElement.appendChild(document.createElement('body'));
}());
node = document.createElement('div');
style = document.createElement('style');
style.setAttribute('type', 'text/css');
style.setAttribute('rel', 'stylesheet');
style.innerHTML = "#selectTest::-ms-expand {width: 500px;} #selectTest{ border:1px solid red }";
select = document.createElement('select');
select.id = 'selectTest';
document.head.appendChild(style);
node.appendChild(select);
root.appendChild(node);
bool = (select.offsetWidth > 200);
root.removeChild(node);
document.head.removeChild(style);
if (fake) {
document.documentElement.removeChild(root);
}
return bool;
}
alert(testMSExpand());