Closed Bug 850840 Opened 11 years ago Closed 10 years ago

html5 error at /research/projects

Categories

(www.mozilla.org :: Pages & Content, defect, P4)

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: georgevidalakis, Assigned: sunnyday195)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130312 Firefox/21.0
Build ID: 20130312042013

Steps to reproduce:

I checked https://www.mozilla.org/en-US/research/projects/ at W3C html validator ( http://validator.w3.org/ ).


Actual results:

It found an empty id value. The error code is the following:

 Line 46, Column 36: Bad value for attribute id on element body: An ID must not be the empty string.

  <body id="" class="html-ltr sand">

Syntax of id:
    An ID consists of at least one character but must not contain any whitespace.


Expected results:

This error should not exist. The id atribute should have a value or it should be removed.
Craig, can you take a quick look and see if this is something we need to fix?
Assignee: nobody → craigcook.bugz
Priority: -- → P4
The attribute is built into the base template because some pages may need an ID as a hook for CSS, but pages that don't define an ID (like this one) don't output anything. We can probably wrap it in some logic to omit the attribute if no ID is defined by the page.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Severity: normal → minor
Component: General → Pages & Content
Hi,

Is it possible to get this assigned to me? Also I looked at the code on this page and it seems like the id value that needs to be set is "projects" based on this code in the page (which of course is not working):

{% set body_id = "projects" %}

I think a reasonable solution would be to replace it with

{% block body_id %}projects{% endblock %}

which does result in id="projects"

Thanks!
(In reply to ShanSM from comment #3)
> Hi,
> 
> Is it possible to get this assigned to me? Also I looked at the code on this
> page and it seems like the id value that needs to be set is "projects" based
> on this code in the page (which of course is not working):

Sorry, I completely forgot about this bug! Feel free to take it. It's a relatively simple fix.


> I think a reasonable solution would be to replace it with
> 
> {% block body_id %}projects{% endblock %}

That does indeed fix the ID for this particular page, so that's easy enough. But we should also include a bit of logic in the base templates to avoid an empty attribute if/when the block isn't defined for a particular page:

{% if self.body_id() %}id="{% block body_id %}{% endblock %}"{% endif %}

OR, alternatively, we could include a default ID so it's never empty, and individual pages can override that with their own values in the block. So in base.html and base-resp.html it might be:

id="{% block body_id %}mozilla-org{% endblock %}"

I'm not sure what the best default body ID might be, though... I'd probably favor the first option. These IDs should be specific to a single page and if it isn't specific it's better to not have an ID at all.
Assignee: craigcook.bugz → nobody
Status: ASSIGNED → NEW
Assignee: nobody → sunnyday195
Commits pushed to master at https://github.com/mozilla/bedrock

https://github.com/mozilla/bedrock/commit/914fe8831d0814f81d6fd592c8db0e69e5056fbc
bug 850840 moved endif block to include extra whitespace

https://github.com/mozilla/bedrock/commit/c10c9099cb8724fdad8954f771dc04a8aeb597f5
Merge pull request #2105 from shansm/body_id

bug 850840 issue with id attribute on body element
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.