Skip to content

Commit

Permalink
Merge pull request #983 from seanpdoyle/support-idempotent-registration
Browse files Browse the repository at this point in the history
Idempotent Custom Element registration
  • Loading branch information
Alberto Fernández-Capel authored Nov 7, 2022
2 parents b6c0047 + 1665e05 commit 12fa9ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/trix/core/helpers/custom_elements.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ registerElement = do ->
Object.setPrototypeOf(constructor.prototype, HTMLElement.prototype)
Object.setPrototypeOf(constructor, HTMLElement)
Object.defineProperties(constructor.prototype, properties)
window.customElements.define(tagName, constructor)
unless window.customElements.get(tagName)
window.customElements.define(tagName, constructor)
constructor
else
(tagName, properties) ->
Expand Down

0 comments on commit 12fa9ef

Please sign in to comment.