com.gargoylesoftware.htmlunit.javascript.host.html.HTMLFrameSetElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of htmlunit Show documentation
Show all versions of htmlunit Show documentation
A headless browser intended for use in testing web-based applications.
/*
* Copyright (c) 2002-2015 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gargoylesoftware.htmlunit.javascript.host.html;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF;
import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.IE;
import com.gargoylesoftware.htmlunit.html.HtmlFrameSet;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClass;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxClasses;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxConstructor;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter;
import com.gargoylesoftware.htmlunit.javascript.configuration.JsxSetter;
import com.gargoylesoftware.htmlunit.javascript.configuration.WebBrowser;
import com.gargoylesoftware.htmlunit.javascript.host.event.EventListenersContainer;
import net.sourceforge.htmlunit.corejs.javascript.Context;
/**
* Wrapper for the HTML element "frameset".
*
* @version $Revision: 10802 $
* @author Bruce Chapman
* @author Ahmed Ashour
* @author Ronald Brill
*/
@JsxClasses({
@JsxClass(domClass = HtmlFrameSet.class,
browsers = { @WebBrowser(CHROME), @WebBrowser(FF), @WebBrowser(value = IE, minVersion = 11) }),
@JsxClass(domClass = HtmlFrameSet.class,
isJSObject = false, browsers = @WebBrowser(value = IE, maxVersion = 8))
})
public class HTMLFrameSetElement extends HTMLElement {
/**
* Creates an instance.
*/
@JsxConstructor({ @WebBrowser(CHROME), @WebBrowser(FF) })
public HTMLFrameSetElement() {
}
/**
* Forwards the events to window.
*
* {@inheritDoc}
*
* @see HTMLBodyElement#getEventListenersContainer()
*/
public EventListenersContainer getEventListenersContainer() {
return getWindow().getEventListenersContainer();
}
/**
* Sets the rows property.
*
* @param rows the rows attribute value
*/
@JsxSetter
public void setRows(final String rows) {
final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
if (htmlFrameSet != null) {
htmlFrameSet.setAttribute("rows", rows);
}
}
/**
* Gets the rows property.
*
* @return the rows attribute value
*/
@JsxGetter
public String getRows() {
final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
return htmlFrameSet.getRowsAttribute();
}
/**
* Sets the cols property.
*
* @param cols the cols attribute value
*/
@JsxSetter
public void setCols(final String cols) {
final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
if (htmlFrameSet != null) {
htmlFrameSet.setAttribute("cols", cols);
}
}
/**
* Gets the cols property.
*
* @return the cols attribute value
*/
@JsxGetter
public String getCols() {
final HtmlFrameSet htmlFrameSet = (HtmlFrameSet) getDomNodeOrNull();
return htmlFrameSet.getColsAttribute();
}
/**
* Gets the "border" attribute.
* @return the "border" attribute
*/
@JsxGetter(@WebBrowser(IE))
public String getBorder() {
final String border = getDomNodeOrDie().getAttribute("border");
return border;
}
/**
* Sets the "border" attribute.
* @param border the "border" attribute
*/
@JsxSetter(@WebBrowser(IE))
public void setBorder(final String border) {
getDomNodeOrDie().setAttribute("border", border);
}
/**
* Overwritten to throw an exception in IE8/9.
* @param value the new value for replacing this node
*/
@JsxSetter
@Override
public void setOuterHTML(final Object value) {
throw Context.reportRuntimeError("outerHTML is read-only for tag 'frameset'");
}
/**
* Overwritten to throw an exception in IE8/9.
* @param value the new value for the contents of this node
*/
@JsxSetter
@Override
public void setInnerHTML(final Object value) {
if (getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS)) {
throw Context.reportRuntimeError("innerHTML is read-only for tag 'frameset'");
}
super.setInnerHTML(value);
}
}