Skip to content

Implement HTMLDetailsElement setter #334

Description

@Jaaap

Please implemement a setter for the HTMLDetailsElement so the JS myDetailsElem.open = true; does not fail with this error anymore:

EcmaError: TypeError: Cannot set property [HTMLDetailsElement].open that has only a getter to value 'true'.

Something like:

Object.defineProperty(HTMLDetailsElement.prototype, 'open', {
	set: function(toOpen) {
		var isOpen = this.hasAttribute("open");
		if (isOpen != toOpen)
		{
			if (toOpen)
				this.setAttribute("open", "");
			else
				this.removeAttribute("open");
		}
	}
});

appears to work for me, feel free to do something similar in htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDetailsElement.java

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions