Opened 7 years ago

Closed 4 years ago

#15008 closed defect (fixed)

HTML5 validation fails after instatiation of widgets

Reported by: Paul Christopher Owned by:
Priority: low Milestone: 2.0
Component: Dijit Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Description

Dojo still uses tags like "widgetid", "_cssstate", "unselectable" without a html5 data prefix. Validation fails therefore.

Steps to reproduce the issue

Create a page containing widgets. Run the page. In IE9, press F12 to open the debug console. Open the html tab. Press the icon "Save" in order to save the "live HTML" containing all the created widgets. Validate the file with http://validator.w3.org/. This fails because of the tags mentioned above.

Expected behavior"

Needs to be "data-widgetid", "data-_cssstate", "data-unselectable"??

Discussion

Minor issue. Just want to mention it for the sake of completeness.

Attachments (1)

liveSnappshot.htm (115.0 KB) - added by Paul Christopher 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Paul Christopher

Attachment: liveSnappshot.htm added

comment:1 Changed 7 years ago by dante

vote as wontfix. Validators don't run javascript, and the declarative/degradable markup used to instantiate widgets is 100% valid. If the browser can _make_ the attributes (despite being 'invalid') the browser can understand the attributes. A page rendered by JS then 'saved' to be validated imo is not a valid use case. The markup would do nothing, nor is dijit in a position to add behavior to pre-rendered html (if that is what you are going after?)

comment:2 Changed 7 years ago by ben hockey

Component: GeneralDijit
Priority: undecidedlow

+1 wontfix.

comment:3 Changed 7 years ago by Paul Christopher

A page rendered by JS then 'saved' to be validated imo is not a valid use case.

If your page doesn't work as intended, it is IMHO a valid way to look at the generated HTML and validate it to figure out potential errors. Invalid HTML is likely to be not understood by browsers and interpreted wrong. But as far as I know most browsers are tolerant enough to ignore tags they don't understand. At the moment you cannot use this approach since you get too many errors (also because ARIA is not an official standard yet).

The markup would do nothing

That is correct. A fix would made the dojo code just consistent: It would use always "data-*" for dojo specific tags.

All in all: It is a minor issue as I said, and I just mentioned it for the sake of completness and since it seems to be a minor, minor but overlooked issue. With the advent of HTML5, the correct way to introduce additional data ("own tags") is the data-tag.

comment:4 Changed 7 years ago by bill

Milestone: tbd2.0

Agreed that it's not a major issue, but might as well fix in 2.0 anyway, because:

  • The _cssState attribute will disappear completely in 2.0 anyway, and we'll just use pseudo-selectors.
  • data-dojo-widgetId is better than widgetId since it's guaranteed not to conflict with another library or with application code.

comment:5 Changed 4 years ago by bill

Resolution: fixed
Status: newclosed

Actually, this isn't an issue in 2.0, because custom Web Components allow any attribute name, for example <d-toolbar alignment=horizontal>. So effectively it's fixed by https://github.com/ibm-js/delite.

Note: See TracTickets for help on using tickets.