Page MenuHomePhabricator

HTML Serializer doesn't handle overlapping tags correctly
Closed, ResolvedPublic

Description

screenshot

Like <b>this <a>example</b></a>. See attachment.


Version: unspecified
Severity: normal

Attached:

Screen_Shot_2011-12-13_at_22.04.51.png (326×972 px, 97 KB)

Details

Reference
bz33048
TitleReferenceAuthorSource BranchDest Branch
maintain-kubeusers: bump deployment quota for anchor-correctorrepos/cloud/toolforge/toolforge-deploy!140taavitaavi/quota-anchor-correctormain
Update jobs that need refinery-job jar at 0.2.24repos/data-engineering/airflow-dags!535milimetricbump-mw-history-jobmain
Customize query in GitLab

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:06 AM
bzimport set Reference to bz33048.
bzimport added a subscriber: Unknown Object (MLST).

This is a known issue with es.HtmlSerializer - unlike the es.ContentView.getHtml method, es.HtmlSerializer doesn't automatically handle nesting problems.

wicke wrote:

A quick trick to fix this might be setting .innerHTML of a hidden element to the new source, and then reading the .innerHTML back. The browser's HTML parser will fix up the nesting according to the HTML spec while parsing the fragment.

While es.ContentView.getHtml handles nesting just fine, the approach you are suggestion may be higher performance than the lengths that getHtml has to go through to produce correct HTML. We need to make sure this is reliable across browsers however, and I suspect IE will choke and die.

wicke wrote:

The parser pipeline uses a JS HTML5 tree builder for nesting fix-ups with standardized behavior, which ought to be identical to the innerHTML method on HTML5-compliant browsers. This tree builder could serve as a pure-JS fall-back for browsers with non-standard parsers if we should standardize on the HTML5 flavor of nesting fix-ups.

Now resolved in new version of Visual Editor.

Mass-moving old VisualEditor tickets to the VE product. Search for this message to mass-delete bugmail.

Noting bugs closed in the 2012-10-15 release.