Skip to content

Commit 6b9c70b

Browse files
author
zamfofex
authored
fix serialization example (#30)
1 parent 0a7b6b9 commit 6b9c70b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ One task `undom` doesn't handle for you by default is HTML serialization. A pro
8383
Element.prototype.toString = function() { return serialize(this); };
8484

8585
function serialize(el) {
86-
return el.nodeType==3 ? enc(el.data) : (
86+
return el.nodeType==3 ? enc(el.nodeValue) : (
8787
'<'+this.nodeName.toLowerCase() + this.attributes.map(attr).join('') + '>' +
8888
this.childNodes.map(serialize).join('') + '</'+this.nodeName.toLowerCase()+'>'
8989
);
9090
}
9191
let attr = a => ` ${a.name}="${enc(a.value)}"`;
92-
let enc = s => s.replace(/[&'"<>]/g, a => `&#${a};`);
92+
let enc = s => s.replace(/[&'"<>]/g, a => `&#${a.codePointAt(0)};`);
9393
```
9494

9595

0 commit comments

Comments
 (0)