Skip to content

Conversation

@oskarer
Copy link

@oskarer oskarer commented Nov 10, 2022

This allows to set mutationFree on any element added in the render() function, not just added or removed child nodes. For example this case which I encountered (not a full example, somewhat psuedo code);

render() {
  const container = document.createElement('div');
  // Also add some input field to set video URL here

  if (data.url) {
    const video = document.createElement('lite-youtube');
    video.dataset.mutationFree = 'true'; // Only works with this PR
    video.setAttribute('videoid', 'someID');
    container.appendChild(video);
  }

  return container;
}

This would trigger the onChange event since lite-youtube is a custom element that adds a lot of elements to the DOM after render() has run. But in reality nothing has really changed, the only thing that should trigger a change is change of the video URL in the <input> field.

oskarer added a commit to Teamtailor/editor.js that referenced this pull request Nov 29, 2022
@neSpecc
Copy link
Member

neSpecc commented Feb 17, 2023

It would be great to have a test case for that change.

I think we'll include it in the upcoming release.

@oskarer
Copy link
Author

oskarer commented Feb 24, 2023

It would be great to have a test case for that change.

I think we'll include it in the upcoming release.

@neSpecc Thanks, can you give me any pointers where a great place would be to add a spec for it? At least I've rebased now so it's mergeable.

@neSpecc
Copy link
Member

neSpecc commented Mar 20, 2023

@neSpecc Thanks, can you give me any pointers where a great place would be to add a spec for it? At least I've rebased now so it's mergeable.

I guess /test/cypress/tests/onChange.spec.ts will be a nice place

emattias pushed a commit to Teamtailor/editor.js that referenced this pull request Apr 17, 2023
@oskarer oskarer closed this Nov 18, 2025
@oskarer oskarer deleted the next branch November 18, 2025 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants