Add insert and replace methods to element
This commit is contained in:
parent
70c702efc7
commit
c3a19d7af8
1 changed files with 7 additions and 0 deletions
|
@ -56,6 +56,13 @@ export default Class => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proto.insert = function(...args) {
|
||||||
|
return (this.shadowRoot || this).append(...args)
|
||||||
|
}
|
||||||
|
proto.replace = function(...args) {
|
||||||
|
return (this.shadowRoot || this).replaceChildren(...args)
|
||||||
|
}
|
||||||
|
|
||||||
Object.prototype[Symbol.toPrimitive] = function(hint) {
|
Object.prototype[Symbol.toPrimitive] = function(hint) {
|
||||||
const name = `to${hint.replace(/./, e => e.toUpperCase())}`
|
const name = `to${hint.replace(/./, e => e.toUpperCase())}`
|
||||||
return name in this
|
return name in this
|
||||||
|
|
Loading…
Reference in a new issue