Skip to content

lwc:dom="manual" is not enforced on childNode.remove() api #934

@ravijayaramappa

Description

@ravijayaramappa

Description

lwc:dom="manual" restriction is not enforced when calling remove() api. https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove
This is inconsistent behavior because the restriction is enforced on removeChild() api.

Additionally, audit if there are other DOM manipulation APIs that the engine is not enforcing the restriction on.

Steps to Reproduce

<template>
      <div>
             <span></span>
      </div>
<template>
export default class Foo extends LightningElement {
     someMethod() {
          const span = this.template.querySelector('span');
          span.remove(); // Does not throw
          span.parent.removeChild(span); // Will throw an exception because of restriction
     }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions