Skip to content

Commit 8cf2a29

Browse files
Replace private method support with _ for now (#321)
1 parent 68165af commit 8cf2a29

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/features/runtime-checks.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ class DDGRuntimeChecks extends HTMLElement {
5353
// Solves re-entrancy issues from React
5454
if (this.#connected) return
5555
this.#connected = true
56-
if (!this.#transplantElement) {
56+
if (!this._transplantElement) {
5757
// Restore the 'this' object with the DDGRuntimeChecks prototype as sometimes pages will overwrite it.
5858
Object.setPrototypeOf(this, DDGRuntimeChecks.prototype)
5959
}
60-
this.#transplantElement()
60+
this._transplantElement()
6161
}
6262

63-
#monitorProperties (el) {
63+
_monitorProperties (el) {
6464
// Mutation oberver and observedAttributes don't work on property accessors
6565
// So instead we need to monitor all properties on the prototypes and forward them to the real element
6666
let propertyNames = []
@@ -93,7 +93,7 @@ class DDGRuntimeChecks extends HTMLElement {
9393
* The element has been moved to the DOM, so we can now reflect all changes to a real element.
9494
* This is to allow us to interrogate the real element before it is moved to the DOM.
9595
*/
96-
#transplantElement () {
96+
_transplantElement () {
9797
// Creeate the real element
9898
const el = initialCreateElement.call(document, this.#tagName)
9999

@@ -153,7 +153,7 @@ class DDGRuntimeChecks extends HTMLElement {
153153
this.insertAdjacentElement('afterend', el)
154154
} catch (e) { console.warn(e) }
155155

156-
this.#monitorProperties(el)
156+
this._monitorProperties(el)
157157
// TODO pollyfill WeakRef
158158
this.#el = new WeakRef(el)
159159

@@ -163,14 +163,14 @@ class DDGRuntimeChecks extends HTMLElement {
163163
}, elementRemovalTimeout)
164164
}
165165

166-
#getElement () {
166+
_getElement () {
167167
return this.#el?.deref()
168168
}
169169

170170
/* Native DOM element methods we're capturing to supplant values into the constructed node or store data for. */
171171

172172
set src (value) {
173-
const el = this.#getElement()
173+
const el = this._getElement()
174174
if (el) {
175175
el.src = value
176176
return
@@ -179,7 +179,7 @@ class DDGRuntimeChecks extends HTMLElement {
179179
}
180180

181181
get src () {
182-
const el = this.#getElement()
182+
const el = this._getElement()
183183
if (el) {
184184
return el.src
185185
}
@@ -196,7 +196,7 @@ class DDGRuntimeChecks extends HTMLElement {
196196
if (supportedSinks.includes(name)) {
197197
return this[name]
198198
}
199-
const el = this.#getElement()
199+
const el = this._getElement()
200200
if (el) {
201201
return el.getAttribute(name)
202202
}
@@ -209,7 +209,7 @@ class DDGRuntimeChecks extends HTMLElement {
209209
this[name] = value
210210
return
211211
}
212-
const el = this.#getElement()
212+
const el = this._getElement()
213213
if (el) {
214214
return el.setAttribute(name, value)
215215
}
@@ -222,7 +222,7 @@ class DDGRuntimeChecks extends HTMLElement {
222222
delete this[name]
223223
return
224224
}
225-
const el = this.#getElement()
225+
const el = this._getElement()
226226
if (el) {
227227
return el.removeAttribute(name)
228228
}
@@ -231,7 +231,7 @@ class DDGRuntimeChecks extends HTMLElement {
231231

232232
addEventListener (...args) {
233233
if (shouldFilterKey(this.#tagName, 'listener', args[0])) return
234-
const el = this.#getElement()
234+
const el = this._getElement()
235235
if (el) {
236236
return el.addEventListener(...args)
237237
}
@@ -240,7 +240,7 @@ class DDGRuntimeChecks extends HTMLElement {
240240

241241
removeEventListener (...args) {
242242
if (shouldFilterKey(this.#tagName, 'listener', args[0])) return
243-
const el = this.#getElement()
243+
const el = this._getElement()
244244
if (el) {
245245
return el.removeEventListener(...args)
246246
}
@@ -263,15 +263,15 @@ class DDGRuntimeChecks extends HTMLElement {
263263
}
264264

265265
remove () {
266-
const el = this.#getElement()
266+
const el = this._getElement()
267267
if (el) {
268268
return el.remove()
269269
}
270270
return super.remove()
271271
}
272272

273273
removeChild (child) {
274-
const el = this.#getElement()
274+
const el = this._getElement()
275275
if (el) {
276276
return el.removeChild(child)
277277
}

0 commit comments

Comments
 (0)