add model for htmlparser2

This commit is contained in:
Erik Krogh Kristensen
2021-02-04 18:26:24 +01:00
parent e2a66bf3ed
commit 0ca2310594
3 changed files with 39 additions and 0 deletions

View File

@@ -149,3 +149,4 @@ typeInferenceMismatch
| xml.js:12:17:12:24 | source() | xml.js:13:14:13:19 | result |
| xml.js:23:18:23:25 | source() | xml.js:20:14:20:17 | attr |
| xml.js:26:27:26:34 | source() | xml.js:26:10:26:39 | convert ... (), {}) |
| xml.js:34:18:34:25 | source() | xml.js:31:18:31:21 | name |

View File

@@ -25,4 +25,13 @@
var convert = require('xml-js');
sink(convert.xml2json(source(), {})); // NOT OK
const htmlparser2 = require("htmlparser2");
const parser = new htmlparser2.Parser({
onopentag(name, attributes) {
sink(name) // NOT OK
}
});
parser.write(source());
parser.end();
})();