Page MenuHomePhabricator

Broken rendering of inserted template (incorrect comment stripping for style attribute)
Closed, ResolvedPublic

Description

  1. Edit page on Wikitech
  2. Insert Template: Archive with parameter date having value 2013.
  3. Insert

Expected: Rainbow background color on the right.

Actual: No background color on the right.

This is because the HTML that was inserted by VisualEditor is as follows

<span style="display: inline-block; float: right; margin:   rgba(255, 0, 0, 0.3), rgba(255, 255, 0, 0.3), rgba(0, 255, 0, 0.3), rgba(0, 255, 255, 0.3), rgba(0, 0, 255, 0.3), rgba(255, 0, 255, 0.3), rgba(255, 0, 0, 0.3)); color: #fff; text-shadow: 0 0 20px deepskyblue, 0 0 20px deepskyblue, 0 0 20px deepskyblue, 0 0 30px deepskyblue, 0 0 45px deepskyblue, 0 0 50px deepskyblue, 0 0 55px deepskyblue, 0 0 60px deepskyblue, 0 0 70px deepskyblue;">2013</span>

Note the part margin: rgba(255, 0, 0, 0.3), ....

Original template:

<span style="display: inline-block; float: right; margin: /*negate mbox-text padding */-0.125em -0.45em; padding: 1em 2em; font-weight: bold; font-size: 2em; text-align: center; line-height: 2; letter-spacing: -1px; background-color: #111; background-image: linear-gradient(to right, /*rainbow*/ rgba(255, 0, 0, 0.3), ...

It seems Parsoid or the Parse API or Tidy is breaking this somehow. By stripping all of /*negate mbox-text padding */-0.125em -0.45em; padding: 1em 2em; font-weight: bold; font-size: 2em; text-align: center; line-height: 2; letter-spacing: -1px; background-color: #111; background-image: linear-gradient(to right, /*rainbow*/.

This does not happen when saving a page and having it rendered by the PHP Parser.

Event Timeline

Krinkle created this task.Jun 5 2017, 11:33 PM
Restricted Application added a project: VisualEditor. · View Herald TranscriptJun 5 2017, 11:33 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 357330 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/services/parsoid@master] T167081: Use non-greedy comment-stripping regexp in the sanitizer

https://gerrit.wikimedia.org/r/357330

ssastry claimed this task.Jun 6 2017, 12:01 AM
ssastry triaged this task as Medium priority.
ssastry moved this task from Backlog to In Progress on the Parsoid board.

Change 357330 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T167081: Use non-greedy comment-stripping regexp in the sanitizer

https://gerrit.wikimedia.org/r/357330

ssastry closed this task as Resolved.Jun 15 2017, 3:47 AM
ssastry removed a project: Patch-For-Review.