mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Make element enumeration Edge compatible
This commit is contained in:
parent
e4e7489dd9
commit
c15eef9425
@ -14,10 +14,9 @@ inherits(PersistentForm, Component)
|
|||||||
PersistentForm.prototype.componentDidMount = function () {
|
PersistentForm.prototype.componentDidMount = function () {
|
||||||
const fields = document.querySelectorAll('[data-persistent-formid]')
|
const fields = document.querySelectorAll('[data-persistent-formid]')
|
||||||
const store = this.getPersistentStore()
|
const store = this.getPersistentStore()
|
||||||
if (!fields) {
|
|
||||||
return
|
for (var i = 0; i < fields.length; i++) {
|
||||||
}
|
const field = fields[i]
|
||||||
fields.forEach((field) => {
|
|
||||||
const key = field.getAttribute('data-persistent-formid')
|
const key = field.getAttribute('data-persistent-formid')
|
||||||
const cached = store[key]
|
const cached = store[key]
|
||||||
if (cached !== undefined) {
|
if (cached !== undefined) {
|
||||||
@ -25,7 +24,7 @@ PersistentForm.prototype.componentDidMount = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
field.addEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
field.addEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistentForm.prototype.getPersistentStore = function () {
|
PersistentForm.prototype.getPersistentStore = function () {
|
||||||
@ -53,12 +52,10 @@ PersistentForm.prototype.persistentFieldDidUpdate = function (event) {
|
|||||||
|
|
||||||
PersistentForm.prototype.componentWillUnmount = function () {
|
PersistentForm.prototype.componentWillUnmount = function () {
|
||||||
const fields = document.querySelectorAll('[data-persistent-formid]')
|
const fields = document.querySelectorAll('[data-persistent-formid]')
|
||||||
if (!fields) {
|
for (var i = 0; i < fields.length; i++) {
|
||||||
return
|
const field = fields[i]
|
||||||
}
|
|
||||||
fields.forEach((field) => {
|
|
||||||
field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
field.removeEventListener(eventName, this.persistentFieldDidUpdate.bind(this))
|
||||||
})
|
}
|
||||||
this.setPersistentStore({})
|
this.setPersistentStore({})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user