Last modified: 2012-12-06 01:33:31 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T44469, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 42469 - VisualEditor: Leading newlines in <pre>s get eaten
VisualEditor: Leading newlines in <pre>s get eaten
Status: RESOLVED FIXED
Product: VisualEditor
Classification: Unclassified
Data Model (Other open bugs)
unspecified
All All
: Normal normal
: VE-deploy-2012-12-10
Assigned To: Roan Kattouw
:
Depends on: 42666 42667
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-27 01:43 UTC by Roan Kattouw
Modified: 2012-12-06 01:33 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Comment 1 Roan Kattouw 2012-11-29 02:21:29 UTC
Mark and I looked at this and discovered it was because VE round-trips the HTML in question through the browser's HTML parser, which turns "<pre>\n" into "<pre>". Shockingly, this is actually mandated by the HTML spec.

We can work around this in the converter by setting a flag on these pre's on the way in and checking for it on the way out.
Comment 2 Roan Kattouw 2012-12-03 19:33:53 UTC
(In reply to comment #1)
> We can work around this in the converter by setting a flag on these pre's on
> the way in and checking for it on the way out.
...or not, grah. Because of the way the DOM API works, I have no way of detecting this from within a browser.
Comment 3 Roan Kattouw 2012-12-03 20:27:55 UTC
The approach we're taking now is that VE will work around this in cases where there are semantically meaningful newlines in the <pre> (i.e. >=1 newline read from the DOM) by adding a newline. That only leaves the ambiguity between <pre>Foo</pre> and <pre>\nFoo</pre> , which is syntactic, not semantic, and will be handled by Parsoid using round-trip data.
Comment 4 Roan Kattouw 2012-12-04 01:24:16 UTC
The VE portion of this is fixed in https://gerrit.wikimedia.org/r/36692 . The Parsoid portion of this is bug 42666 and bug 42667.
Comment 5 Roan Kattouw 2012-12-06 01:33:31 UTC
Parsoid fixes have landed, issue confirmed fixed in VE as well.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links