Skip to content

Commit fe32e8d

Browse files
authored
Merge pull request #55 from jameswassink/fix/prototype-pollution-removeAttributeNS
Fix prototype pollution in removeAttributeNS
2 parents bf7b691 + 6c5f31a commit fe32e8d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dom-element.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,10 @@ DOMElement.prototype.getAttributeNS =
128128

129129
DOMElement.prototype.removeAttributeNS =
130130
function _Element_removeAttributeNS(namespace, name) {
131+
// Safely access and delete the attribute
131132
var attributes = this._attributes[namespace];
132-
if (attributes) {
133-
delete attributes[name]
133+
if (attributes && Object.prototype.hasOwnProperty.call(attributes, name)) {
134+
delete attributes[name];
134135
}
135136
}
136137

0 commit comments

Comments
 (0)