@Override public boolean has(final int index, final Scriptable start) { if (getBrowserVersion().hasFeature(JS_SELECT_OPTIONS_IN_ALWAYS_TRUE)) { return true; } return super.has(index, start); }
/** * Returns the {@code offscreenBuffering} property. * @return the {@code offscreenBuffering} property */ @JsxGetter({CHROME, IE}) public Object getOffscreenBuffering() { if (getBrowserVersion().hasFeature(JS_WINDOW_FRAMES_ACCESSIBLE_BY_ID)) { return "auto"; } return true; }
/** * Returns the value of the {@code width} property. * @return the value of the {@code width} property */ @JsxGetter(propertyName = "width") public String getWidth_js() { final boolean ie = getBrowserVersion().hasFeature(JS_TABLE_COLUMN_WIDTH_NO_NEGATIVE_VALUES); final Boolean returnNegativeValues = ie ? Boolean.FALSE : null; return getWidthOrHeight("width", returnNegativeValues); }
/** * Returns the value of the {@code align} property. * @return the value of the {@code align} property */ @JsxGetter public String getAlign() { final boolean invalidValues = getBrowserVersion().hasFeature(HTMLELEMENT_ALIGN_INVALID); return getAlign(invalidValues); }
/** * Sets the value of the {@code width} property. * @param width the value of the {@code width} property */ @JsxSetter public void setWidth(final String width) { setWidthOrHeight("width", width, !getBrowserVersion().hasFeature(JS_TABLE_CELL_WIDTH_DOES_NOT_RETURN_NEGATIVE_VALUES)); }
/** * Returns the value of the {@code width} property. * @return the value of the {@code width} property */ @JsxGetter(propertyName = "height") public String getHeight_js() { final boolean ie = getBrowserVersion().hasFeature(JS_TABLE_CELL_HEIGHT_DOES_NOT_RETURN_NEGATIVE_VALUES); final Boolean returnNegativeValues = ie ? Boolean.TRUE : null; return getWidthOrHeight("height", returnNegativeValues); }
/** * Sets the value of the {@code height} property. * @param height the value of the {@code height} property */ @JsxSetter public void setHeight(final String height) { setWidthOrHeight("height", height, !getBrowserVersion().hasFeature(JS_TABLE_CELL_HEIGHT_DOES_NOT_RETURN_NEGATIVE_VALUES)); }
/** * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br> * * Helper for a common call sequence. * @param feature the feature to check * @return {@code true} if the currently emulated browser has this feature. */ public boolean hasFeature(final BrowserVersionFeatures feature) { return getPage().getWebClient().getBrowserVersion().hasFeature(feature); }
@Override public Object call(final Context cx, final Scriptable scope, final Scriptable thisObj, final Object[] args) { if (getBrowserVersion().hasFeature(JS_DOCUMENT_FORMS_FUNCTION_SUPPORTED)) { return super.call(cx, scope, thisObj, args); } throw Context.reportRuntimeError("TypeError: document.embeds is not a function"); } };
/** * {@inheritDoc} */ @Override public void executeEventLocally(final Event event) { if (Event.TYPE_LOAD != event.getType() || !isAttachedToPageDuringOnload_ || getBrowserVersion().hasFeature(JS_IFRAME_ALWAYS_EXECUTE_ONLOAD)) { super.executeEventLocally(event); } }
/** * Returns the value of the {@code clear} property. * @return the value of the {@code clear} property */ @JsxGetter public String getClear() { final String clear = getDomNodeOrDie().getAttributeDirect("clear"); if (getBrowserVersion().hasFeature(JS_CLEAR_RESTRICT) && !ArrayUtils.contains(VALID_CLEAR_VALUES, clear)) { return ""; } return clear; }
/** * Returns the value of the {@code width} property. * @return the value of the {@code width} property */ @JsxGetter(propertyName = "width") public String getWidth_js() { final boolean ie = getBrowserVersion().hasFeature(JS_TABLE_CELL_WIDTH_DOES_NOT_RETURN_NEGATIVE_VALUES); final Boolean returnNegativeValues = ie ? Boolean.TRUE : null; return getWidthOrHeight("width", returnNegativeValues); }
/** * {@inheritDoc} */ @Override public DisplayStyle getDefaultStyleDisplay() { if (getPage().getWebClient().getBrowserVersion().hasFeature(SLOT_CONTENTS)) { return DisplayStyle.CONTENTS; } return DisplayStyle.INLINE; } }
/** * {@inheritDoc} */ @Override public String getClassName() { if (getWindow().getWebWindow() != null && getBrowserVersion().hasFeature(JS_BGSOUND_AS_UNKNOWN)) { return "HTMLUnknownElement"; } return super.getClassName(); }
/** * {@inheritDoc} */ @Override public Page mouseOver(final boolean shiftKey, final boolean ctrlKey, final boolean altKey, final int button) { final SgmlPage page = getPage(); if (page.getWebClient().getBrowserVersion().hasFeature(EVENT_ONMOUSEOVER_NEVER_FOR_SELECT_OPTION)) { return page; } return super.mouseOver(shiftKey, ctrlKey, altKey, button); }
/** * Sets the {@code outlineWidth} style attribute. * @param outlineWidth the new attribute */ @JsxSetter public void setOutlineWidth(final Object outlineWidth) { final boolean requiresUnit = !getBrowserVersion().hasFeature(CSS_OUTLINE_WIDTH_UNIT_NOT_REQUIRED); setStyleLengthAttribute(OUTLINE_WIDTH.getAttributeName(), outlineWidth, "", false, false, true, requiresUnit); }
/** * Sets the {@code verticalAlign} style attribute. * @param verticalAlign the new attribute */ @JsxSetter public void setVerticalAlign(final Object verticalAlign) { final boolean auto = getBrowserVersion().hasFeature(CSS_VERTICAL_ALIGN_SUPPORTS_AUTO); setStyleLengthAttribute(VERTICAL_ALIGN.getAttributeName(), verticalAlign, "", auto, true, false, false); }
/** * Sets the {@code wordSpacing} style attribute. * @param wordSpacing the new attribute */ @JsxSetter public void setWordSpacing(final Object wordSpacing) { setStyleLengthAttribute(WORD_SPACING.getAttributeName(), wordSpacing, "", false, getBrowserVersion().hasFeature(JS_STYLE_WORD_SPACING_ACCEPTS_PERCENT), false, false); }
/** * {@inheritDoc} */ @Override public String getFont() { if (getBrowserVersion().hasFeature(CSS_COMPUTED_NO_Z_INDEX) && getElement().getDomNodeOrDie().isAttachedToPage()) { return super.getFont(); } return ""; }
/** * Sets the value of the {@code value} attribute. * @param value the new value */ @Override public void setValue(final Object value) { if (null == value && getBrowserVersion().hasFeature(JS_TEXT_AREA_SET_VALUE_NULL)) { ((HtmlTextArea) getDomNodeOrDie()).setText(""); return; } ((HtmlTextArea) getDomNodeOrDie()).setText(Context.toString(value)); }