-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patch: Failed comparison of activeFormattingElements entry with Marker #44
Comments
Hm. It doesn't happen for me with this test case: var HTML5 = require('../../lib/html5'),
test = require('tap').test;
test("test 1", function(t) {
var p = new HTML5.Parser()
p.parse("<body><table><tr><td>Hello</td></tr></table</body>");
p.parse("<body><table><tr><td>Hello</td></tr></table</body>");
t.pass("Works");
t.end();
}); Do you have test data that triggers it? |
I can trigger it reliably when running through MediaWiki's 600-odd parser tests, but have not yet been able to reproduce it in a minimal test case in the shell. The error always occurs in the same test cases, all related to tables. The first string that triggers it is I'll see if I can track down where the second marker is coming from, or if I can create a minimal test case. |
Awesome. Or just a link to the parser tests would rock, I'll poke at it too. |
I just added the information needed to try it at https://www.mediawiki.org/wiki/Future/Parser_development#Trying_it_out. If you search for 'normalize' in the output you should find the error messages from the parser. I use less -R as a searchable viewer with color. The code generating the error is all in parserTests.js. Basically, we use the stock html parser to parse and re-serialize the expected test output (for normalization). This part is where the failure occurs. We also use a hacked-up tree builder in a separate module as a backend for our wiki parser, but that should not affect the plain use of the npm module as the namespaces are separate. |
This is needed until aredridel/html5#44 is merged into the upstream "html5" module.
On node 0.6.3 and html5 v0.3.5, parsing multiple page fragments with the same parser sometimes causes failures in the treebuilder, which are caused by a pointer-unequal marker element in reconstructActiveFormattingElements and elementInActiveFormattingElements. The problem is mainly triggered if the parsed fragments contain tables.
The following patch converts the pointer equality based check into a node type check, which fixes the problem for me:
The text was updated successfully, but these errors were encountered: