JSHTMLSelectElementCustom.cpp [plain text]
#include "config.h"
#include "JSHTMLSelectElementCustom.h"
#include "CustomElementReactionQueue.h"
#include "ExceptionCode.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
#include "HTMLSelectElement.h"
#include "JSHTMLOptionElement.h"
#include "JSHTMLSelectElement.h"
namespace WebCore {
using namespace JSC;
using namespace HTMLNames;
void selectElementIndexSetter(JSC::ExecState& state, HTMLSelectElement& element, unsigned index, JSC::JSValue value)
{
VM& vm = state.vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
if (value.isUndefinedOrNull()) {
element.remove(index);
return;
}
auto* option = JSHTMLOptionElement::toWrapped(value);
if (!option) {
setDOMException(&state, throwScope, TYPE_MISMATCH_ERR);
return;
}
propagateException(state, throwScope, element.setOption(index, *option));
}
void JSHTMLSelectElement::indexSetter(JSC::ExecState* state, unsigned index, JSC::JSValue value)
{
CustomElementReactionStack customElementReactionStack;
selectElementIndexSetter(*state, wrapped(), index, value);
}
}