Page MenuHomePhabricator

Flow: Make our HTML validate
Open, MediumPublic

Description

HTML validation will make it more likely that our code doesn't run into cross-browser issues. In order for this to be most useful, we need a clean slate, so we can easily see when new issues crop up.

The base href error in particular is apparently causing the validator to ignore certain errors ("Suppressing further errors from this subtree"). There is a duplicate attribute error at https://www.mediawiki.org/wiki/Talk:Flow_QA with both data-flow-api-handler="watchItem" and data-flow-api-handler="watchTopic". I'm not sure why, but the validator is not picking that up, even though it does pick up the same thing in a self-contained test case (which is otherwise valid).

The errors are:

  1. "Element base not allowed as child of element div in this context." (it's not allowed in the body)
  2. "Attribute name not allowed on element script at this point." for "<script name="handlebars-template-progressive-enhancement"" (never used, only the type is).

There are also some warnings:

  1. "Potentially bad value ... for attribute datetime on element time: Year may be mistyped." This is apparently because our time_iso is not actually ISO time; it is also not valid for this parameter. It seems that it should be an error, but the validator is going easy on us (possibly because it's confused with something else).

Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=70743

Details

Reference
bz73291

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:50 AM
bzimport set Reference to bz73291.
bzimport added a subscriber: Unknown Object (MLST).

gerritadmin wrote:

Change 172668 had a related patch set uploaded by Mattflaschen:
Use core's postWithToken for watching, which handles badtoken

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

It seems we are already re-writing links on the server, so may not even need a base href.

Relatedly, Parsoid recently changed to generate HTML with a constant base href for the whole wiki. If we do need a base href still, this should make things much easier with the same content appearing on both topics and boards. If we eventually show content on another wiki, though, it won't solve that alone (since different wikis will still have different base hrefs).


C. Scott provided some help in IRC:

[11/13/14 16:53] <cscott> superm401: if you actually properly resolve the given URL with the given base HREF, your pages will continue to work both before and after

I don't know if we preserve old base hrefs given by parsoid though.

He also said:

[11/13/14 16:54] <cscott> superm401: and if you ignore base href and just replace(/([.][.]?\/)*/, '') on your hrefs to get article titles, your pages will also continue to work both before and after

Note MobileFrontend has a make validate command which tests for validation errors.. This may be of use to you.

That's cool. I didn't know the W3C validator had a JSON output mode.

gerritadmin wrote:

Change 172668 merged by jenkins-bot:
Use core's postWithToken for watching, which handles badtoken

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

matthiasmullie set Security to None.