static BrowserConfiguration getMatchingConfiguration( final BrowserVersion browserVersion, final BrowserConfiguration[] browserConfigurations) { for (final BrowserConfiguration browserConfiguration : browserConfigurations) { if (browserVersion.getNickname().startsWith(browserConfiguration.browserFamily_) && browserVersion.getBrowserVersionNumeric() >= browserConfiguration.minVersionNumber_ && browserVersion.getBrowserVersionNumeric() <= browserConfiguration.maxVersionNumber_) { return browserConfiguration; } } return null; }
static BrowserConfiguration getMatchingConfiguration( final BrowserVersion browserVersion, final BrowserConfiguration[] browserConfigurations) { for (final BrowserConfiguration browserConfiguration : browserConfigurations) { if (browserVersion.getNickname().startsWith(browserConfiguration.browserFamily_) && browserVersion.getBrowserVersionNumeric() >= browserConfiguration.minVersionNumber_ && browserVersion.getBrowserVersionNumeric() <= browserConfiguration.maxVersionNumber_) { return browserConfiguration; } } return null; }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * @return whether or not this version version 52 of a Firefox browser */ public boolean isFirefox52() { return isFirefox() && getBrowserVersionNumeric() == 52; }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * @return whether or not this version version 52 of a Firefox browser */ public boolean isFirefox52() { return isFirefox() && getBrowserVersionNumeric() == 52; }
/** * Replace a single conditional compilation variable * @param variable something like "@_win32" * @return the value */ private static String replaceOneVariable(final String variable, final BrowserVersion browserVersion) { final String[] varNaN = {"@_win16", "@_mac", "@_alpha", "@_mc680x0", "@_PowerPC", "@_debug", "@_fast"}; final String[] varTrue = {"@_win32", "@_x86", "@_jscript"}; if (ArrayUtils.contains(varTrue, variable)) { return "true"; } else if ("@_jscript_version".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "5.6"; } return "5.7"; } else if ("@_jscript_build".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "6626"; // that's what my IE6 currently returns } return "5730"; } else if (ArrayUtils.contains(varNaN, variable)) { return "NaN"; } return variable; } }
/** * Replace a single conditional compilation variable * @param variable something like "@_win32" * @return the value */ private static String replaceOneVariable(final String variable, final BrowserVersion browserVersion) { final String[] varNaN = {"@_win16", "@_mac", "@_alpha", "@_mc680x0", "@_PowerPC", "@_debug", "@_fast"}; final String[] varTrue = {"@_win32", "@_x86", "@_jscript"}; if (ArrayUtils.contains(varTrue, variable)) { return "true"; } else if ("@_jscript_version".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "5.6"; } return "5.7"; } else if ("@_jscript_build".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "6626"; // that's what my IE6 currently returns } return "5730"; } else if (ArrayUtils.contains(varNaN, variable)) { return "NaN"; } return variable; } }
/** * Replace a single conditional compilation variable * @param variable something like "@_win32" * @return the value */ private static String replaceOneVariable(final String variable, final BrowserVersion browserVersion) { final String[] varNaN = {"@_win16", "@_mac", "@_alpha", "@_mc680x0", "@_PowerPC", "@_debug", "@_fast"}; final String[] varTrue = {"@_win32", "@_x86", "@_jscript"}; if (ArrayUtils.contains(varTrue, variable)) { return "true"; } else if ("@_jscript_version".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "5.6"; } return "5.7"; } else if ("@_jscript_build".equals(variable)) { if (browserVersion.getBrowserVersionNumeric() <= 6) { return "6626"; // that's what my IE6 currently returns } return "5730"; } else if (ArrayUtils.contains(varNaN, variable)) { return "NaN"; } return variable; } }
private boolean testToIncludeForBrowserConstraint(final Element element, final BrowserVersion browser) { if ((!browser.isIE() || !"Internet Explorer".equals(element.getAttribute("name"))) && (!browser.isFirefox() || !"Firefox".equals(element.getAttribute("name")))) { return false; } final String max = element.getAttribute("max-version"); float maxVersion; if (max.length() == 0) { maxVersion = 0; } else { maxVersion = Float.parseFloat(max); } if ((maxVersion > 0) && (browser.getBrowserVersionNumeric() > maxVersion)) { return false; } float minVersion; final String min = element.getAttribute("min-version"); if (min.length() == 0) { minVersion = 0; } else { minVersion = Float.parseFloat(min); } if ((minVersion > 0) && (browser.getBrowserVersionNumeric() < minVersion)) { return false; } return true; }
private boolean testToIncludeForBrowserConstraint(final Element element, final BrowserVersion browser) { if ((!browser.isIE() || !"Internet Explorer".equals(element.getAttribute("name"))) && (!browser.isFirefox() || !"Firefox".equals(element.getAttribute("name")))) { return false; } final String max = element.getAttribute("max-version"); float maxVersion; if (max.length() == 0) { maxVersion = 0; } else { maxVersion = Float.parseFloat(max); } if ((maxVersion > 0) && (browser.getBrowserVersionNumeric() > maxVersion)) { return false; } float minVersion; final String min = element.getAttribute("min-version"); if (min.length() == 0) { minVersion = 0; } else { minVersion = Float.parseFloat(min); } if ((minVersion > 0) && (browser.getBrowserVersionNumeric() < minVersion)) { return false; } return true; }
/** * Gets the major version of the scripting engine. * @see <a href="http://msdn.microsoft.com/en-us/library/x7cbaet3.aspx">MSDN doc</a> * @return the major version */ @JsxFunction(IE) public int ScriptEngineMajorVersion() { return getBrowserVersion().getBrowserVersionNumeric(); }
private boolean testToIncludeForBrowserConstraint(final Element element, final BrowserVersion browser) { if ((!browser.isIE() || !"Internet Explorer".equals(element.getAttribute("name"))) && (!browser.isFirefox() || !"Firefox".equals(element.getAttribute("name")))) { return false; } final String max = element.getAttribute("max-version"); float maxVersion; if (max.length() == 0) { maxVersion = 0; } else { maxVersion = Float.parseFloat(max); } if ((maxVersion > 0) && (browser.getBrowserVersionNumeric() > maxVersion)) { return false; } float minVersion; final String min = element.getAttribute("min-version"); if (min.length() == 0) { minVersion = 0; } else { minVersion = Float.parseFloat(min); } if ((minVersion > 0) && (browser.getBrowserVersionNumeric() < minVersion)) { return false; } return true; }
/** * Gets the major version of the scripting engine. * @see <a href="http://msdn.microsoft.com/en-us/library/x7cbaet3.aspx">MSDN doc</a> * @return the major version */ @JsxFunction(value = IE, functionName = "ScriptEngineMajorVersion") public int scriptEngineMajorVersion() { return getBrowserVersion().getBrowserVersionNumeric(); }
/** * Returns the {@code documentMode} property. * @return the {@code documentMode} property */ @JsxGetter(IE) public int getDocumentMode() { if (documentMode_ != -1) { return documentMode_; } compatMode_ = "CSS1Compat"; if (isQuirksDocType()) { compatMode_ = "BackCompat"; } final float version = getBrowserVersion().getBrowserVersionNumeric(); documentMode_ = (int) Math.floor(version); return documentMode_; }
/** * Returns the {@code documentMode} property. * @return the {@code documentMode} property */ @JsxGetter(IE) public int getDocumentMode() { if (documentMode_ != -1) { return documentMode_; } compatMode_ = "CSS1Compat"; if (isQuirksDocType()) { compatMode_ = "BackCompat"; } final float version = getBrowserVersion().getBrowserVersionNumeric(); documentMode_ = (int) Math.floor(version); return documentMode_; }
if (src.startsWith(JAVASCRIPT_PREFIX)) { if (!ie || browser.getBrowserVersionNumeric() != 7) { String code = StringUtils.removeStart(src, JAVASCRIPT_PREFIX).trim(); final int len = code.length();
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }
/** * Returns the JavaScript default value of this object. This is the JavaScript equivalent of a toString() in Java. * * @param hint a hint as to the format of the default value (ignored in this case) * @return the default value */ @Override public Object getDefaultValue(final Class< ? > hint) { if (String.class.equals(hint) || hint == null) { // TODO: shouldn't we handle this with BrowserVersion.hasFeature? if (getBrowserVersion().isIE()) { return "[object]"; // the super helpful IE solution } else if (getBrowserVersion().getBrowserVersionNumeric() >= 3) { // Firefox 3 return "[object " + getClassName() + "]"; } else { // Firefox2 is not fully coherent here (see WindowTest#windowProperties) final Window window = (Window) getTopLevelScope(this); if (ScriptableObject.getProperty(window, getClassName()) == this) { return "[" + getClassName() + "]"; } return "[object " + getClassName() + "]"; } } return super.getDefaultValue(hint); }
workPiece_ = new BrowserVersion(version.getBrowserVersionNumeric(), version.getNickname());
workPiece_ = new BrowserVersion(version.getBrowserVersionNumeric(), version.getNickname());