Quick Edit generates invalid html markup, even for users (e.g. Anonymous) who don't have access to in-line edit.
Specifically, W3C validation script complains about a div inside h1 which is invalid and also about the unknown data-quickedit-field-id attribute:
<div id="content" class="column"><div class="section">
<a id="main-content"></a>
<h1 class="title" id="page-title">
<div data-quickedit-field-id="node/1/title/und/full">Site name</div> </h1>
<div class="tabs">
</div>
<div class="region region-content">
<div id="node-1" class="node node-page node-full clearfix" data-quickedit-entity-id="node/1">
<div class="content clearfix">
<div class="field field-name-body field-type-text-with-summary field-label-hidden" data-quickedit-field-id="node/1/body/und/full"><div class="field-items"><div class="field-item even"><p>Welcome to our page!</p>
I understand that this is necessary in order for Quick Edit to work, but I think it would be better if this markup was added only for users that have access to in-line edit. This way, most of the site would still appear valid to W3C validation engine, Google bots etc.
Comments
Comment #1
yannisc commentedHere is a patch that does just that: Adds the Quick Edit markup only for users that have access to in-place editing. Drupal is HTML valid again.
I tested and seems to work, but further testing is needed for sure, as I don't know what other implications this might have.
Comment #3
yannisc commentedThe test failed, because the testbot checks as anonymous user. I don't know how to fix the test. Should we make the test check as registered user (and how) or should we remove this test?
Comment #4
frazac_naba commentedI quote the problem.
Here my code output for anonymous user.
Thanks for working on it
Comment #5
jonasdk commentedI guess this is solved here https://www.drupal.org/node/2528498
Comment #6
devin carlson commentedThanks for the patch!
I've updated the tests to verify that the markup is only output for privileged users and changed the requirements check to require anonymous users be granted the ability to quick edit in order to perform the compatibility testing.
Comment #7
devin carlson commentedTested #6 and committed to Quick Edit 7.x-1.x.
Comment #9
yannisc commentedGreat News! Thanks!!