Page MenuHomePhabricator

Make placeholder a shallow copy
Closed, ResolvedPublic

Description

In our new MediaElement handling, we create a placeholder. We do this with jquery's clone function. jQuery's clone function is a deep clone, meaning it will also duplicate all source and track children, which is needlessly expensive.

Instead:

  1. use Node.cloneNode() which is shallow
  2. probably we should also remove the src attribute
  3. remove the id attribute

This might significantly improve the performance of this initial step in our loader.

Event Timeline

Change 757981 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/TimedMediaHandler@master] Do not clone track and source children for placeholder

https://gerrit.wikimedia.org/r/757981

TheDJ triaged this task as Medium priority.

Change 757981 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Do not clone track and source children for placeholder

https://gerrit.wikimedia.org/r/757981