/** * Sets the value of the attribute "type". * Note: this replace the DOM node with a new one. * @param newType the new type to set */ public void jsxSet_type(final String newType) { HtmlInput input = getHtmlInputOrDie(); if (!input.getTypeAttribute().equalsIgnoreCase(newType)) { final AttributesImpl attributes = readAttributes(input); final int index = attributes.getIndex("type"); attributes.setValue(index, newType); final HtmlInput newInput = (HtmlInput) InputElementFactory.instance .createElement(input.getPage(), "input", attributes); if (input.getParentNode() != null) { input.getParentNode().replaceChild(newInput, input); } else { // the input hasn't yet been inserted into the DOM tree (likely has been // created via document.createElement()), so simply replace it with the // new Input instance created in the code above input = newInput; } input.setScriptObject(null); setDomNode(newInput, true); } }
/** * Sets the value of the attribute "type". * Note: this replace the DOM node with a new one. * @param newType the new type to set */ public void jsxSet_type(final String newType) { HtmlInput input = getHtmlInputOrDie(); if (!input.getTypeAttribute().equalsIgnoreCase(newType)) { final AttributesImpl attributes = readAttributes(input); final int index = attributes.getIndex("type"); attributes.setValue(index, newType); final HtmlInput newInput = (HtmlInput) InputElementFactory.instance .createElement(input.getPage(), "input", attributes); if (input.getParentNode() != null) { input.getParentNode().replaceChild(newInput, input); } else { // the input hasn't yet been inserted into the DOM tree (likely has been // created via document.createElement()), so simply replace it with the // new Input instance created in the code above input = newInput; } input.setScriptObject(null); setDomNode(newInput, true); } }
/** * Sets the value of the attribute "type". * Note: this replace the DOM node with a new one. * @param newType the new type to set */ public void jsxSet_type(final String newType) { HtmlInput input = getHtmlInputOrDie(); if (!input.getTypeAttribute().equalsIgnoreCase(newType)) { final AttributesImpl attributes = readAttributes(input); final int index = attributes.getIndex("type"); attributes.setValue(index, newType); final HtmlInput newInput = (HtmlInput) InputElementFactory.instance .createElement(input.getPage(), "input", attributes); if (input.getParentNode() != null) { input.getParentNode().replaceChild(newInput, input); } else { // the input hasn't yet been inserted into the DOM tree (likely has been // created via document.createElement()), so simply replace it with the // new Input instance created in the code above input = newInput; } input.setScriptObject(null); setDomNode(newInput, true); } }
if (input.getParentNode() == null) { input.getParentNode().replaceChild(newInput, input);
if (input.getParentNode() == null) { input.getParentNode().replaceChild(newInput, input);