https://github.com/mozilla/pdf.js/blob/9bed695ebde488b49d39290087f72ba224bd1078/examples/node/domstubs.js#L84-L87
```javascript
  setAttributeNS: function DOMElement_setAttributeNS(NS, name, value) {
    value = value || '';
    value = xmlEncode(value);
    this.attributes[name] = value;
```

https://github.com/mozilla/pdf.js/blob/9bed695ebde488b49d39290087f72ba224bd1078/examples/node/domstubs.js#L105

```javascript
      buf.push(' ' + i + '="' + xmlEncode(this.attributes[i]) + '"');
```

One of the two should be removed. Most likely the first one, because `getAttributeNS`'s implementation just returns `this.attributes[i]`, and that should not be encoded.
case 5: 
        while (true) {
          const value =
            this._childSerializer && this._childSerializer.getNext();
          if (value !== null) {
            return value;
          }
          const nextChild = node.childNodes[this._loopIndex++];
          if (nextChild) {
            this._childSerializer = new DOMElementSerializer(nextChild);
          } else {
            this._childSerializer = null;
            ++this._state;
            break;
          }
        }
      
      case 6: 
        ++this._state;
        return "</" + node.nodeName + ">";
      case 7: 
        return null;
      default:
        throw new Error("Unexpected serialization state: " + this._state);
    }
  },
};
const document = {
  childNodes: [],
  get currentScript() {