| 247 | } |
| 248 | |
| 249 | public appendChild(newChild: IRRNode): IRRNode { |
| 250 | const nodeType = newChild.RRNodeType; |
| 251 | if ( |
| 252 | nodeType === RRNodeType.Element || |
| 253 | nodeType === RRNodeType.DocumentType |
| 254 | ) { |
| 255 | if (this.childNodes.some((s) => s.RRNodeType === nodeType)) { |
| 256 | throw new Error( |
| 257 | `RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${ |
| 258 | nodeType === RRNodeType.Element ? 'RRElement' : 'RRDoctype' |
| 259 | } on RRDocument allowed.`, |
| 260 | ); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | const child = appendChild(this, newChild); |
| 265 | child.parentElement = null; |
| 266 | return child; |
| 267 | } |
| 268 | |
| 269 | public insertBefore(newChild: IRRNode, refChild: IRRNode | null): IRRNode { |
| 270 | const nodeType = newChild.RRNodeType; |