3

I'm running into problems with some ArcGIS Server JavaScript code (page elements are positioned different in IE than FF/Chrome), so I checked it against the HTML validators at http://validator.w3.org and http://html5.validator.nu

Many errors were found, so I returned to the official Esri JS samples to ensure I was using valid code. Surprisingly, I found that many of the samples also failed the validators.

Examples of errors include:

Error: Attribute label not allowed on element button at this point.
<button id="dropdownButton" iconClass="bingIcon" label="Base" data-dojo-type="dijit.form.DropDownButton">

from the Basemap sample.

Is it a problem that the official Esri samples fail the validators? Is this related to the use of DOJO, and therefore not an actual problem?

3
  • 2
    This is a red herring. Markup that correctly validates in no way implies that it will look the same cross browser. Commented Dec 8, 2011 at 17:25
  • @DerekSwingley true, but markup that doesn't validate could cause problems because the browsers can handle errors differently, no? Some of my non-map elements looked good in FF but were positioned incorrectly in IE. Fixing invalid HTML markup resolved these problems. Commented Dec 8, 2011 at 22:21
  • Some good info on the SitePen blog today: sitepen.com/blog/2012/01/19/html5-data-dojo-attribute-support Commented Jan 20, 2012 at 5:19

2 Answers 2

2

You are getting the validation error because esri is using declarative dojo syntax which is not valid w3c html. After the dojo.parser updates the html it should be valid markup. In your example they are actually mixing the html5 acceptable way and the old way. label is not allowed on a button. I'd imagine dojo slips that <button>label</button> around there. if you had data-dojo-props='label: "Base"' it would allow for this to pass w3c validation. Since dojo, in the past, didn't really care about the validation to allow for declarative markup, I'd say that it was ok to ignore those element attributes. The new html spec allows for you to have valid markup and achieve the same thing.

Since esri is still using dojo 1.6 and the data-dojo-props isn't that reliable I can see them waiting to fix all of these until their api is built upon 1.7. That being said, samples and documentation often get the least amount of attention.

To answer your question, those validation errors and the use of dojo will not cause your browser rendering differences.

1
1

I personally don't think it's a problem if it's related to a feature (button, link, etc) on the webmap. As long as you've tested your webmap in the browsers you intend to support, support as many modern browsers as practical, and make your supported browsers clear to your users, I think you've done all you need to.

Considering all the rapid changes, different JS libraries, and competing ideas that may or may not become part of the HTML5 standard, I think W3C validation of web maps is mostly overkill until HTML5 is officially a standard. I say "mostly overkill" because the validation is still good for basic page elements that are part of the webmap.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.