mojs / mojs/mojs-player

Check if element '#icon' already is created

Open
#18 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

optimization
Dominant language
JavaScript
Stars
305
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Currently mojs-player creates an element in the top of body that looks like this:

<div id="icons">
  <svg ...>
    <path id="play-icon-shape" d="...">
    ...
  </svg>
</div>

This is for using svg elements as icons in the player controller.

Problem
When using mulitple instances of mojs-player on the same page, we get dublicates of these elements.

Solution
Should be easy to check if the element already excist in the dom before creating it again.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the mojs-player code that creates the body-level #icons element and trace how it runs for each player instance. Verify the behavior with multiple instances on one page; done means the shared icon container is created only once and both controllers continue to use it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.