Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT/ADDENDUM:</strong> Just realized you are trying to dig into the specifics of how <code>getComputedStyle()</code> on IE9 versus other browsers. So caveat if this script is not what you are looking for since it seems to simply test for the existence of <code>getComputedStyle()</code> and not specific selection options. </p> <p><a href="http://www.sitepoint.com/forums/showthread.php?289765-getComputedStyle-not-working-in-Safari-1-3-2-0" rel="nofollow">This site</a> seems to offer a solution to detecting <code>getComputedStyle</code> across browsers. Specifically this code near the bottom of the page:</p> <pre><code>&lt;script type="text/javascript"&gt; // First paramter is a nodes id, second the CSS property you want function getCSSProperty(sNodeId, sProperty) { var oNode = document.getElementById(sNodeId); if(document.defaultView) { return document.defaultView.getComputedStyle(oNode, null).getPropertyValue(sProperty); } else if(oNode.currentStyle) { var sProperty = sProperty.replace(/-\D/gi, function(sMatch) { return sMatch.charAt(sMatch.length - 1).toUpperCase(); }); return oNode.currentStyle[sProperty]; } else return null; } alert(getCSSProperty("myDiv", "margin-bottom")); &lt;/script&gt; </code></pre> <p><strong>EDIT:</strong> The original poster has a question about the regular expression logic and this is my attempt to explain. If I am wrong, please let me know or comment on what you think it is:</p> <pre><code> var sProperty = sProperty.replace(/-\D/gi, function(sMatch) { return sMatch.charAt(sMatch.length - 1).toUpperCase(); }); </code></pre> <p>Okay, that chunk of code is doing a regular expression replace with the actual regular expression being <code>/-\D/gi</code>. Using <a href="http://www.cs.tut.fi/~jkorpela/perl/regexp.html" rel="nofollow">this guide to regular expressions</a> (aka: regex) I think I understand it.</p> <p>The <code>/</code> are delimiters; the magic happens between them. The <code>-</code> is simply matching a dash. The <code>\D</code> is a special notation that means, “matches any non-digit character”. And the <code>gi</code> is specific to the regex call and <a href="http://www.cprenterprisesonline.com/elearning/jsref/jsref_regexp_modifier_gi.asp.htm" rel="nofollow">explained here</a> as: “The <code>gi</code> modifier is used to do a case insensitive search of all occurrences of a regular expression in a string.”</p> <p>The nested function acts on a matches in the <code>replace</code> regex and basically does a <code>.toUpperCase()</code> on matches.</p> <p>So it seems that you might be able to adapt this to match deeper functionality you are trying to detect? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload